Data Configuration Settings
In the configure() method you can create a structure called wirebox in the variables scope that will hold the configuration data for WireBox. You can configure WireBox for operation using these structures or via programmatic method calls.
/**
* Configure WireBox
*/
function configure(){
// The WireBox configuration structure DSL
wireBox = {
// LogBox Config: instantiation path
logBoxConfig : "wirebox.system.ioc.config.LogBox",
// CacheBox
cacheBox : { enabled : true },
// Scope registration: automatically put the injector in a CF scope on startup
// Default: application scope
scopeRegistration : {
enabled : true,
scope : "application", // server, session, application
key : "wireBox"
},
// DSL Namespace registrations
customDSL : {
// namespace : "mapping name"
},
// Custom Storage Scopes
customScopes : {
// annotationName : "mapping name"
},
// Package scan locations
scanLocations : [],
// Stop Recursions
stopRecursions : [],
// Parent Injector (object reference)
parentInjector : "",
// Register all event listeners (in execution order)
listeners : [
// { class : "", name : "", properties : {} }
],
// Automatically process all mappings on startup for metadata inspection.
// Default: false (lazy load for performance)
autoProcessMappings : false,
// Transient injection cache (per-request)
transientInjectionCache : true
}
// Map Bindings below
}logBoxConfig
The path to the LogBox Configuration object to use. By default, it uses the one displayed below. If you are using WireBox within a ColdBox application, the LogBox configuration is taken from the ColdBox application.
cachebox
If you are using WireBox within a ColdBox application, this setting is ignored, and it will use the ColdBox application's CacheBox configuration. The following are the keys for this configuration structure:
scopeRegistration
This structure tells WireBox how to leach itself into any ColdFusion scope when initialized instead of you placing it in the scope.
customDSL
Please refer to the Custom DSL section to find out more about custom DSLs; the following are just the way you declare them:
customScopes
Please refer to the Custom scopes section to find out more about custom scopes, the following are just the way you declare them:
scanLocations
The instantiation paths that this Injector will have registered to do object locations in order. So if you request an object called Service and no mapping has been configured for it, then WireBox will search all these scan locations for a Service.bx (or .cfc for CFML) in the specified order. The last lookup is the no namespace lookup which basically represents a createObject("component","Service") call. If you are using WireBox within a ColdBox application, ColdBox will register the models convention folder for you.
stopRecursions
This is an array of class path's that WireBox will use to stop recursion on any object graph that has inheritance when looking for dependencies.
parentInjector
This setting is actually a reference to another parent injector you would like this injector to set as its parent injector. Now say this sentence 10 times without hiccuping.
listeners
This section only shows you how to register WireBox listeners, so please refer to the object life cycle events section for more information. This setting is an array of listener structure definitions that WireBox's event manager will use when broadcasting object life cycle events.
transientInjectionCache
Enable or disable the per-request cache of transient injections and delegations. When enabled, WireBox reuses the already-resolved dependencies for a transient mapping during the same request, reducing repeated wiring work. Default is true.
autoProcessMappings
When set to true, all mappings registered in the binder will be eagerly processed for metadata inspection at injector startup. By default (when false), WireBox uses lazy loading — mappings are only inspected for DI metadata the first time they are requested. Enabling this option increases startup time but ensures all annotation errors are caught at boot.
Last updated
Was this helpful?