开发者

How do I access a bean outside of a controller in ColdFusion Model Glue 3?

Model Glue 3 introduced bean injection, which allows you to do this in a controller to access it:

beans.component.function();

However, the beans scope is only available for a controller. How would I ac开发者_如何学JAVAcess a bean outside of a controller, for example in Application.cfc or a helper UDF? I have a SimpleConfig bean that I'd like to access some config info for.


It's going to depend on your bean factory -- most likely ColdSpring. If your ColdSpring instance is saved in Application.beanFactory (I think this is the default, it's been some time since I last used ModelGlue), then you would do the following:

variables.config = application.beanFactory.getBean("SimpleConfig");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜