Daniel Mejia
06/21/2022, 7:48 PMbinder.mapDirectory('modules')
Daniel Mejia
06/21/2022, 7:51 PMproperty name="hyper" inject="HyperBuilder@hyper";
but I get this error:
The target 'DuoClient' requested a missing dependency with a Name of 'hyper' and DSL of 'HyperBuilder@hyper' {"javaCast":null,"ref":null,"scope":"variables","required":true,"value":null,"dsl":"HyperBuilder@hyper","type":"any","argName":"","name":"hyper"}
The error occurred on line wirebox\system\ioc\Builder.cfc:621
elpete
06/21/2022, 8:15 PMModuleService
.
With the code you've shared, you are very likely registering the CFCs inside Hyper. The difference is ColdBox’s ModuleService
adds a suffix or namespace of @#moduleName#
.
So, you can either use the module name without the namespace (i.e. HyperBuilder
), loop over the directories in modules
and apply the suffix yourself when calling mapDirectory
(which is what ColdBox’s ModuleService
does), or wire each needed mapping manually with the necessary mapping and namespace.Daniel Mejia
06/21/2022, 8:21 PMDaniel Mejia
06/21/2022, 8:25 PMnew Hyper.models.HyperRequest();
For this to work I would need a mapping for "Hyper".elpete
06/21/2022, 8:27 PMelpete
06/21/2022, 8:27 PMDaniel Mejia
06/21/2022, 8:28 PMDaniel Mejia
06/21/2022, 8:31 PMThe DSLNamespace: box cannot be used as it requires a ColdBox Context <br>The error occurred on line wirebox\system\ioc\Builder.cfc:519
elpete
06/21/2022, 8:34 PMelpete
06/21/2022, 8:34 PMDaniel Mejia
06/21/2022, 8:35 PMDaniel Mejia
06/21/2022, 8:37 PMelpete
06/21/2022, 8:38 PMmap( "HyperBuilder@hyper" )
.to( "hyper.models.HyperBuilder" )
.property( name = "interceptorService", value = javacast( "null", "" ) );
Daniel Mejia
06/21/2022, 8:41 PMElement REF is undefined in a CFML structure referenced as part of an expression.
The error occurred on line wirebox\system\ioc\Injector.cfc:1111
Daniel Mejia
06/21/2022, 8:42 PMcomponent {
function configure(required binder){
// The WireBox configuration structure DSL
wireBox = {
// DI for custom models
scanLocations = [
"models"
],
// Scope registration, automatically register a wirebox injector instance on any CF scope
// By default it registeres itself on application scope
scopeRegistration = {
enabled = true,
scope = "application", // server, cluster, session, application
key = "wireBox"
},
// DSL Namespace registrations
customDSL = {
// namespace = "mapping name"
},
// Custom Storage Scopes
customScopes = {
// annotationName = "mapping name"
},
// Stop Recursions
stopRecursions = [],
// Parent Injector to assign to the configured injector, this must be an object reference
parentInjector = "",
// Register all event listeners here, they are created in the specified order
listeners = [
// { class="", name="", properties={} }
]
};
// DI for forgebox modules (not entirely working)
// binder.mapDirectory('modules');
binder.map( "HyperBuilder@hyper" )
.to( "hyper.models.HyperBuilder" )
.property( name = "interceptorService", value = javacast( "null", "" ) );
binder.map("DuoClient").to("login-security.DuoClient");
}
}
Daniel Mejia
06/21/2022, 8:48 PMbdw429s
06/21/2022, 8:48 PMDaniel Mejia
06/21/2022, 8:48 PMbdw429s
06/21/2022, 8:48 PMApplication.cfc
and let it do its thing loading modules and suchbdw429s
06/21/2022, 8:49 PMbdw429s
06/21/2022, 8:49 PMapplication.wirebox.getInstance( 'hyperBuilder@hyper' )
elpete
06/21/2022, 8:49 PMelpete
06/21/2022, 8:50 PMDaniel Mejia
06/21/2022, 8:53 PMthis.mappings['Hyper'] = 'modules/hyper';
var hyper = new Hyper.models.HyperBuilder();
and I think that is it? This is much simpler.Daniel Mejia
06/21/2022, 8:55 PMDaniel Mejia
06/21/2022, 9:00 PMbdw429s
06/21/2022, 9:00 PMDaniel Mejia
06/21/2022, 9:01 PMbdw429s
06/21/2022, 9:01 PMtoo complicated and I'd go as far as saying not even supportedNot sure what you mean there. ColdBox can always be bootstrapped into another application and used to load modules and there's nothing wrong with that. I've done that for several clients who had a legacy site they wanted to drop some box goodness into.
Daniel Mejia
06/21/2022, 9:01 PMbdw429s
06/21/2022, 9:02 PMI think most of those are prefixed with "cb"No, the prefix means nothing, lol. That's just a convention Luis used to use back in the day for all his modules. It's basically random.
bdw429s
06/21/2022, 9:02 PMcbFoo
may be more likely to depend on ColdBox, but it's not really a good indicator.bdw429s
06/21/2022, 9:03 PMDaniel Mejia
06/21/2022, 9:04 PMbdw429s
06/21/2022, 9:05 PMbdw429s
06/21/2022, 9:05 PMbdw429s
06/21/2022, 9:05 PMbox.json
makes it a packagebdw429s
06/21/2022, 9:06 PMbdw429s
06/21/2022, 9:06 PMModuleConfig.cfc
makes something a "module" (be it ColdBox, CommandBox, or Contentbox)bdw429s
06/21/2022, 9:07 PMDaniel Mejia
06/21/2022, 9:08 PM