Directives
These are the global configuration settings for the runtime
Below, you can find all the configuration directives the language supports.
These directives will be placed in the boxlang.jsonfile at the root level:
{
"directive": value
}Application Timeout
The default timeout for applications in BoxLang. The default is 0 = never expires. The value must be a string timespan using the syntax shown:
// Use Timespan syntax: "days, hours, minutes, seconds"
"applicationTimeout": "0,0,0,0",Class Generation Directory
This is the location where BoxLang will store compiled classes.
"classGenerationDirectory": "${boxlang-home}/classes"Class Paths
BoxLang allows you to register global locations where we can discover BoxLang classes (.bx files). These must be absolute paths or use variable substitutions.
// A collection of directories to lookup box classes in (.bx files), they must be absolute paths
"classPaths": [
"${boxlang-home}/global/classes"
]Class Resolver Cache
This enables the class locations cache for the runtime, used when resolving class paths, mappings, and per-request mappings. This is recommended for production environments.
Compiler
The compiler to use for BoxLang files. BoxLang supports multiple compilation strategies:
asm(default) - Uses ASM bytecode generation for optimal performance and modern JVM featuresjava- Generates Java source code first, then compiles to bytecode (legacy approach)
Recommendation: Use the default asm compiler for production. It provides better performance and supports modern JVM features. The java compiler is primarily maintained for backward compatibility and debugging purposes and requires the boxlang-compiler-java module.
Clear Class Files On Startup
This setting will remove all class files from the class generation directory on startup. Useful for debugging and testing, but not recommended for production.
Custom Components Directory
BoxLang allows you to register global locations where we can register custom components for use in your templates:
Default Datasource
The name of the default datasource to use for database operations when no datasource is explicitly specified.
Max Tracked Completed Threads
The maximum number of completed threads to track for a single request. This prevents memory issues by flushing old completed threads.
Store Class Files On Disk
Controls whether compiled class files are stored on disk for reuse between restarts. When enabled, compiled classes persist across runtime restarts, improving startup performance. When disabled, class files are stored in memory only and lost on restart.
Trusted Cache
This enables the runnable loader's cache on disk for compiled BoxLang classes. When enabled, BoxLang will load a class and never inspect the file again. Enable for production, disable for development.
Version
The version of the BoxLang runtime (automatically populated during build).
Whitespace Compression
Enable whitespace compression in output. Currently only used by web runtimes.
Debug Mode
This is a powerful setting. It puts the runtime into debug mode, where more verbose debugging will be activated, and when exceptions occur, more information will be shown by default. The default is false an we highly discourage its use in production.
Default Datasource
The name of the default datasource to use for database operations when no datasource is explicitly specified.
You can set this to the name of any datasource defined in the datasources configuration section. See the Datasources section for more details.
Default Remote Method Return Format
The default return format for class invocations via web runtimes.
Invoke Implicit Accessors
In BoxLang, implicit accessors default to true for BoxScript (.bx) files and false for CFML (.cfc) files. This means that properties on a class can be accessed externally, like field properties for mutation or access. You can override this default behavior by setting this configuration option.
Simple example:
Java Library Paths
BoxLang allows you to register an array of locations or array of jars or classes that the runtime will class load into the runtime class loader. This allows you to class-load Java applications at runtime.
By default, we look into the lib folder in your BoxLang home.
Locale
This is the default locale for the runtime. By default, we use the JVM locale. This value must be an IETF BCP language tag: https://www.oracle.com/java/technologies/javase/jdk21-suported-locales.html
Mappings
Here is where you can create global class mappings in BoxLang. Mappings are used to discover BoxLang classes, files, and more. You can prefix the name of the mapping with / or not. Ultimately, BoxLang will add leading and trailing slashes for you (e.g., core becomes /core/).
Simple Mappings
The simple format is a string value representing the absolute path location. These mappings default to external: true, meaning they are externally accessible.
Complex Mappings
The complex format is a JSON object with the following properties:
path
string
✅ Yes
-
The absolute path location of the mapping
external
boolean
No
true
Whether this mapping is externally accessible
External vs Internal Mappings
The external flag controls whether a mapping is accessible from external requests (web requests):
external: true(default) - The mapping can be accessed by web requests and resolved in templatesexternal: false- The mapping is only accessible internally to the runtime and not exposed to web requests
Security Best Practice: Use external: false for mappings that contain sensitive code, configuration, or internal utilities that should not be accessible via web requests.
Complete Example
Modules Directory
BoxLang will search your home for a modules folder and register the modules found. However, you can add multiple locations to search for BoxLang modules. Each entry must be an absolute location.
Request Timeout
The default timeout for requests in BoxLang. The default is 0 = never expire. The value must be a string timespan using the syntax shown:
Session Timeout
The default timeout for sessions in BoxLang. The default is 30 minutes. The value must be a string timespan using the syntax shown:
Session Storage
In BoxLang, you can configure your user sessions to be stored in memory by default in a BoxLang sessions cache, or you can give it a custom cache name to store them in. If it's not memory` then it must be a valid registered cache. (See Caches)
Timezone
This is the global timezone to use in the runtime. By default, it will use the JVM timezone. This value requires IANA timezone database values: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
Use High Precision Math
By default BoxLang uses high-precision mathematics via BigDecimal operations. It analyses your operations and determines the precision accordingly. You can turn this off here for all applications and use Double based operations. If you disable this feature, then if you want high precision you will have to use the precisionEvaluate( expression ) BIF instead.
Valid Class Extensions
This is an array of all the extensions that will be processed as BoxLang classes. By default we target bx, cfc.
Valid Template Extensions
This is an array of all the extensions that will be processed as BoxLang templates. Meaning you can execute them and include them. The core template extensions are bxm, bxs, bxml, cfml, cfm, cfs and are always available. Here you can add other extensions that will process as templates.
Last updated
Was this helpful?
