私の Grails アプリケーションには、Atmosphere フレームワーク ハンドラー クラスとして NotificationsAtmosphereHandler があります。その中で springSecurityService サービスを使用したいと思います。サービス オブジェクトをハンドラー クラスに挿入するにはどうすればよいですか?
def springSecurityService
通常のサービス注入は機能しません。
私の Grails アプリケーションには、Atmosphere フレームワーク ハンドラー クラスとして NotificationsAtmosphereHandler があります。その中で springSecurityService サービスを使用したいと思います。サービス オブジェクトをハンドラー クラスに挿入するにはどうすればよいですか?
def springSecurityService
通常のサービス注入は機能しません。
resources.xml:
<bean id="notificationsAtmosphereHandler" class="your.package.NotificationsAtmosphereHandler"/>
クラスで:
class NotificationsAtmosphereHandler {
.....
@Autowired
SpringSecurityService springSecurityService
.....
}
または、resources.groovy で Groovy の方法で実行します。
import package.NotificationsAtmosphereHandler
//...
notificationsAtmosphereHandler(NotificationsAtmosphereHandler) { bean ->
bean.autowire = 'byName'
}
この方法では、@Autowired 表記も必要ありません。