coldspring

I'm evaluating coldbox, and definitely like what I see. I have a
question though.

I prefer to control the creation of my coldspring factory, is there a
way for me to create the coldspring factory and then tell coldbox to
use the instance I have set up (ala model-glue parent bean factory)?

It's almost a deal breaker if this can't be done, as I will need to
share the same instance of coldspring across multiple sub-applications
some not using coldbox. I suppose I could write a plugin that wraps
the request to get my instance of coldspring. Is that what people do?
Or is there a built in mechanism?

Thanks

Hi jon,

Yes, you can do this super easily with the ioc plugin. The only deal is that you will not configure the IOC parameters in the configuration file, since you will be doing this manually. The ioc plugin has several methods that you can use to load it with the correct IOC container.

setIOCFramework(‘coldspring’)
setIoCFactory( THE FACTORY YOU CREATED GOES HERE )

Now, in order to take advantage of the autowire interceptor you can create your own coldspring loader as an interceptor that executes on ‘config’. This will allow all the pieces that use autowire to behave the same way, but you loading the coldspring factory. This might sound chineses, but just read the interceptors guide. You can create a coldpspringLoader interceptor that will take care of loading/unloading any coldspring factories you like in your application. Does this make sense?

Another important fact, is that you can request a new instance of the ioc plugin and create multiple coldspring factories. You can then persist them on the coldbox cache with their specifc aliases.

As you can see, the flexibility is all there for you. Let me know if you have more questions.

Luis

Very nice, I’m more and more impressed with coldbox. That makes perfect sense. Thanks for the prompt reply…

Thanks for the prompt reply.

Thanks Jon.

Here is some sample code I have inside of my loaderInterceptor I have in one of my apps. There are no interception points, because I just load up my own coldspring factory when the application loads. However, you can reload the configuration file also.

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.

Hope this helps Jon.