Could you clarify what you mean by “autowire” as opposed to “WireBox”? Are you referring to the old compatible BeanFactory plugin that used the modelMappings.cfm config file or something else?
> With Autowire it is simple and easy to use, but I believe this will be phased out for favour of WieBox.
The old BeanFactory plugin has been phased out in favor of WireBox, but you will always be able to “autowire” your components. Any component you get from WireBox will be autowired (unless it is disabled for that component) and the autowire interceptor is still at play to wire up things like handlers. Point is though-- it’s still all WireBox doing the work.
> With Autowire, it automatically knows the directories to look into for DI. WireBox inside ColdBox does not.
I’m not sure if I follow that statement. Perhaps it’s because I’m not sure what the differentiation is between “Autowire” and “WireBox”.
> If I use the default settings for WireBox, non of the handlers, models, modules, plugins etc are automatically added to WireBox
If you mean that mappings are not created for these objects, that would be correct for handlers, modules, and plugins. Any model paths relative to the ROOT of the models folder should and will be accessible per the docs.
> property name="someService: inject=“model:someService”:
To confirm, for this to work the following file would need to exist: <site_root>/model/someService.cfc
> it will throw an undefined error, this is because the model Directory is not automatically being added to WireBox from ColdBox conventions,
Can you post your WireBox config?
> which means that if one is to change the convention, you have to manually change WireBox to reflect this change.
Yes. Did you expect something different? Using a convention different from the default one will require a configuration change.
> Why doesn’t ColdBox automatically add the convention paths to WireBox for us?
If by convention paths, you mean “<site_root>/model/”, it should. Please confirm the location of your models and your config for us so we can take a look.
Also, it is important to note that model conventions are NOT recursive. Therefore, <site_root>/model/security/securityService.cfc will not be picked up with the DSL “model:securityService”. You would need to use the full package name of “model:security.securityService”. If you want recursive searching (and don’t want to configure mappings for all your components) then use the mapDirectory() function in the config like so: mapDirectory(“model”). That should make the first DSL work (model:securityService)