Moving from Autowire to Wirebox not as easy as it sounds

I have an issue with WireBox when using it inside of the ColdBox framework, that I am hoping someone can give more answers too.

With Autowire it is simple and easy to use, but I believe this will be phased out for favour of WieBox. But I have a serious problem with this and ColdBox that I have brought to the table on many occasions that still hasn’t been solved, or any real definitive answer.

With Autowire, it automatically knows the directories to look into for DI. WireBox inside ColdBox does not.

For example and I might be wrong, but my tests show otherwise.

If I use the default settings for WireBox, non of the handlers, models, modules, plugins etc are automatically added to WireBox, meaning that if you try to use

property name="someService: inject=“model:someService”:

And then try to use this it will throw an undefined error, this is because the model Directory is not automatically being added to WireBox from ColdBox conventions, which means that if one is to change the convention, you have to manually change WireBox to reflect this change.

So unless I am not doing this right, my question was before ColdBox 3.0 was release is still valid today.

Why doesn’t ColdBox automatically add the convention paths to WireBox for us?

Hi Andrew,

If I understand your question then I would say there is something wrong with your particular setup.

I inject things into my handles and services exactly as you have and it works just fine with the coldbox built in wirebox instance.

It does cover in the docs the scan directory that if uses by default to find models I think.


Do you have a sample of that?

I did say with the default settings of WireBox, is the problem.

I do, although not in the office right now.

I’ll send over an example in the morning.

Do you have any specific rules setup? Or is your application using the absolute standard default config?

Where are your models stored? In a folder called Model?