Not sure I am doing this right, have tried a few alternatives and can’t see any examples in the docs.
component name=“skinService” singleton output=“false” {
property name=“logBox” inject=“logbox” ;
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
public skinService function init() output=“false” {
writeDump(logBox); abor****t;
Throws an autowire exception.
Error autowiring system.controllers.appController. Error constructing model: skinService Variable LOGBOX is undefined.coldfusion.runtime.UndefinedVariableException:
Anyone know the proper way for this?
Regards,
Andrew Scott
http://www.andyscott.id.au/
hmm, that looks good, weird. Add logging level of debug to the beanfactory to see what is happening internally.
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
If it helps it appears that no injection is taking place before the init, so that might be the problem. I just tried this with another injection and it too failed in the init method.
Regards,
Andrew Scott
http://www.andyscott.id.au/
DI happens after init is called. If you want to use your injected properties on object creation, use the onDIComplete method.
~Brad
Cheers that makes sense.
Regards,
Andrew Scott
http://www.andyscott.id.au/
or use constructor arguemnts if you would like to use init, granted metadata in arguments only works on 9.0.1
function init(logbox inject=“logbox”){
variables.logbox = arguments.logbox;
}
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
Ooh that is a nice trick to know…
Regards,
Andrew Scott
http://www.andyscott.id.au/
By the way, I've never seen this "singleton"-attribute before and I
cannot find anything about it. Is this a ColdSpring notation? Where is
it coming from?