[coldbox:4253] injecting into RequestContextDecorator

Hi,

Im need an instance from the IOC in my RequestContextDecorator.

I have much problems trying to do this in coldbox 2.6.4

- calling getcontroller.getplugin('ioc') in configure method does not
work, see:
    http://groups.google.com/group/coldbox/browse_thread/thread/6bbd7bccaeb13b3/71a32d3b1fd30fd5?lnk=gst&q=getplugin+bug#71a32d3b1fd30fd5

- cfproperty injection does not seem to work

- making a getSomeInstance() method and calling it when needed does
not work as the IOC plugin is not yet configured.

Is this fixed in coldbox 3?

greets,
klaas

Btw, I hope someone can give me a fix or tell me if CB 3 will fix it soon, as im completely stuck on it…

Can you expand your issue I am not really understanding it

Hi luis,

I have an extension of coldbox.system.web.context.requestContextDecorator, which i have configured coldbox to use in the coldbox.xml.

This decorator needs an instance of a cfc from coldfspring.

I tried to do this by doing this:

(also putting autowire=“true” in the cfcomponent tag)

but its not injected.

Also, getController().getPlugin(“IOC”) returns an un-configured ioc plugin, so i cant use it.

Can i use the cfproperty in the decorator of coldbox 3M5 to inject from coldspring?

greets,
klaas

It seems that the bug with calling getController.getPlugin(“IOC”), which is not configured in coldbox 2.6.4 when called from the decorator…

has been fixed in coldbox 3.0.0 M5…!

(though, cfproperty based injection does not work)

greets,
klaas

The cache manager is cAsE sEnSiTiVe. In 2.6.x I belive the proper case is “ioc”. Give that a try.

Ooh, so getPlugin( 'ioc' ) in 2.6.x but getPlugin( 'IOC' ) in 3.0?
Isn't that going to cause people hassle when they upgrade?

Ayep. I believe that to be the case. Or would that be cAsE? o_0

isnt cb 3 case insensitive? it should be i think as cfc names are also case insensitive… when using createobject… it should be the same i think…

3.0 is case insensitive, 2.6 was case sensitive, so no worries anymore about case. As for property injections on the decorator, that has never existed, and I don’t think that will be added.

You can get the controller object and get anything you like from it, but this is 3.0 only.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Thanks luis,
Do you know of the top of your head if its possible in 3.0 to call the getPlugin method from the controller in the configure method? As that would put coldbox in an infinite loop with NeoBodyContext exceptions…

greets,
klaas

Try it :slight_smile:
Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com