I’m trying to use the configBean which I injected into my component. I can’t seem to use it in an init function.
component
{
property name=“configBean” inject=“coldbox:ConfigBean”;
function init()
{
if (configBean.getConfigStruct().ENVIRONMENT eq ‘PRODUCTION’)
{
//do some stuff
}
else
{
}
}
}
Sorry hit send before finishing. Is there some reason why I can’t use the configBean in the init function but I can in other functions?
Thanks.
andrews
3
Yes, because the object has to be instantiated before injection can take place.
Thanks. Can anyone tell me the best way to set an application wide variable based on environment?
andrews
5