I am working on a security interceptor and I am having trouble injecting a Coldspring object into it. I have seen some older responses on the list regarding setting up the IOC object in the configure (here config) method of the interceptor, but the setIOCFramework() and setIOCFactory() methods seem not to exist any longer.
From this thread:
https://groups.google.com/forum/#!searchin/coldbox/interceptor$20with$20Ioc/coldbox/cS2s09IW5o0/Olm9ufgEfHQJ
`
var ioc = getPlugin("ioc");ioc.setIOCFramework(’
coldspring’);
// get the factory from the application scope.
ioc.setIOCFactory( application.coldspring );
//You can create your own coldspring factory here too and do all you need here too.
//That’s it. I just configured manually the IOC plugin.
`
I have also tried ading the ioc settings as a property in the interceptor definition:
// Coldbox.cfc
`
{ class=“interceptors.HTTPSecurity”,
properties={ioc=ioc} },
`
and then accessing the IOC object (with or without the above property in Coldbox.cfc )
`
//interceptor definition
component {
property name=“ioc” inject=“ioc”;
void function configure(){
variables.SecurityService = ioc.getBean( “SecurityService” );
}
…
}
`
None of this seems to be working. With this latest configuration (showed here) I get a#
The containsBean method was not found.
error in the IOC plugin, line 123, which says to me that the IOC plugin is not configured.
I also tried extending the Interceptor class and setting up the IOC object in my init() method
`
component extends=‘coldbox.system.Interceptor’{
any function init(required coldbox.system.web.Controller controller, required struct properties){
super.init(argumentcollection=arguments);
var ioc = getPlugin( “ioc” ).init( controller=arguments.controller );
variables.SecurityService = ioc.getBean( “SecurityService” );
return this;
}
…
}
`
I feel like I am missing something obvious. Can anyone show me how to wire this up so I can access my Coldspring object inside my interceptor?
Thanks
Robert
This is also not working.