Now if I remove the WireBox interceptor nothing, and I mean nothing gets Di’ed into my components.
Firstly, why would you want to remove the autowire interceptor? It is necessary to autowire handlers, plugins and interceptors. The autowire interceptor is not a replacement for WireBox, it uses WireBox to inject dependencies into pieces of the framework. It will go away eventually, is a requirement for now if you want autowiring to happen for handlers, plugins, and interceptors.
Secondly, it works fine for me. If remove the autowire interceptor, then get a user object that is in my models folder, via getPlugin(“beanFactory”).getModel(“user”), that user object is correctly autowired with all of its dependencies.
And as for removing it I was under the impression that WireBox is suppose to work without it, yes it works if you do but only to a point. Like I said in my next post, with an example given as well.
WireBox is the bean factory abstracted to another name, ALL previous ColdBox functionality remains PLUS all the additional stuff. The autowire interceptor is needed (FOR NOW) so it bridges wirebox( or other DI engines) into ColdBox related objects: handlers, plugins, interceptors). As far as the conventions go, that is the case also, if you look in Binder.cfc you will see that it adds the model folder as the default scan location for coldbox in order to resolve the conventions. Also, the module service you can see it also adds more scan locations to a modules “model” folder. So again, all conventions remain as normal and previous versions. The compatibility bean factory is only left there to support cf7 and ALL of its features and capabilities are still in wirebox.
So, I am really at a loss at your issue of not finding model:MyService if /model/MyService.cfc exists as that is the core convention.
And that is empty, and as I stated all I did was remove the interceptor AutoWire from the config.cfc for ColdBox… Are you beginning to see the problem?
Also another failure is with this line of code, which will no longer work.
So if I switch the AutoWire interceptor off, then there are problems with the DI here. And I am asking why?
I thought I made that last line of code very clear in another post. maybe not. So this brings me back to ColdBox and WireBox as a package, if AutoWire is phased out, will ColdBox handle this under the hood when using code like the appendExternalLocation and others without me having to tell WireBox of these modifications?
And why does the interceptors directory I created work with AutoWire and not without?
Still works, see the code:
if( instance.compatMode ){
instance.beanFactory.appendExternalLocations(arguments.locations);
return;
}
wirebox.getBinder().scanLocations( arguments.locations );
It adds to the scan locations.
So if I switch the AutoWire interceptor off, then there are problems with the DI here. And I am asking why?
You are not supposed to turn it off.
The autowire interceptor NEVER wired anything. It was a listener that delegated back to whatever DI library you are using to wire objects.
Thanks Luis, it wasn’t clear from what I was reading if WireBox could live on its own. So when and if you do remove the AutoWire interceptor that you do make sure these problems will not exist, which knowing you will not be an issue.