将服务注入Grails Atmosphere Handler类 [英] Injecting service into Grails Atmosphere Handler class
本文介绍了将服务注入Grails Atmosphere Handler类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的Grails应用程序中有一个NotificationsAtmosphereHandler作为Atmosphere框架处理程序类。我想在里面使用springSecurityService服务。
def springSecurityService
如何将服务对象注入到处理程序类中? pre>
通常的服务注入不起作用。 解决方案
.xml:
< bean id =notificationsAtmosphereHandlerclass =your.package.NotificationsAtmosphereHandler/>
在课堂上:
class NotificationsAtmosphereHandler {
.....
@Autowired
SpringSecurityService springSecurityService
.....
}
code>
I have an NotificationsAtmosphereHandler as an Atmosphere framework handler class in my Grails application. I would like to use springSecurityService service inside of it. How I can inject service object into my handler class?
def springSecurityService
The usual service injection does not work.
解决方案
resources.xml:
<bean id="notificationsAtmosphereHandler" class="your.package.NotificationsAtmosphereHandler"/>
in class:
class NotificationsAtmosphereHandler {
.....
@Autowired
SpringSecurityService springSecurityService
.....
}
这篇关于将服务注入Grails Atmosphere Handler类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文