Mappings & Class Resolution
Understanding module mappings, class resolution, and the @moduleName notation
Every BoxLang module receives automatic mappings for class resolution and optional web access. Understanding these mappings is essential for importing classes and serving web content.
Internal Module Mapping
When a module is registered, BoxLang creates an internal mapping for class resolution:
Path
bxModules.{moduleName}
Internal class path prefix
Physical
Module root directory
Where classes/BIFs/components live
Web Access
❌ No
Only for class resolution
For a module named myModule, the internal mapping bxModules.myModule points to the module root. This is used for class resolution only — it's not web-accessible.
Public Web Mapping
For serving static files via HTTP, BoxLang creates a public mapping:
Folder
{moduleRoot}/public/
✅ this.publicMapping
URL Path
/bxModules/{name}/public/
✅ Override mapping name
Files in myModule/public/css/style.css are accessible at:
http://yourserver.com/bxModules/myModule/public/css/style.cssCustomizing Mappings
Override defaults in your module descriptor:
The @moduleName Notation
BoxLang provides a powerful syntax for explicitly addressing classes from specific modules using the @moduleName suffix. This improves performance and eliminates ambiguity.
Why Use @moduleName?
Without @moduleName:
BoxLang searches ALL modules
Slower with many modules loaded
Ambiguous if duplicates exist
With @moduleName:
Direct lookup in the specified module
Faster resolution
No ambiguity
Importing BoxLang Classes
Importing Java Classes from Modules
The same notation works for Java classes packaged in modules:
Using createObject()
Class Loading Hierarchy
When resolving a class with @moduleName, BoxLang searches:
Module's compiled classes (
modules.{moduleName}package prefix)Module's
libs/folder (JAR dependencies)Parent class loader — for a module nested inside another, that is the containing module's loader, which then falls back to its parent, and so on up to the runtime class loader
Runtime class loader (BoxLang core classes — final fallback)
This isolation ensures modules don't interfere with each other's dependencies. A nested module is the deliberate exception: it can see what its parent bundles, while staying isolated from its siblings.
Custom Class Resolvers
Modules can register custom class resolvers with unique prefixes (extending the built-in bx: and java: resolvers). See Advanced Collaboration for details.
Best Practices
Next Steps
Configuration — Module settings and runtime overrides
Advanced Collaboration — System settings providers and class resolvers
Capabilities — BIFs, components, services, and more
Last updated
Was this helpful?
