2

私の Grails アプリケーションには、Atmosphere フレームワーク ハンドラー クラスとして NotificationsAtmosphereHandler があります。その中で springSecurityService サービスを使用したいと思います。サービス オブジェクトをハンドラー クラスに挿入するにはどうすればよいですか?

def springSecurityService

通常のサービス注入は機能しません。

4

2 に答える 2

2

resources.xml:

 <bean id="notificationsAtmosphereHandler" class="your.package.NotificationsAtmosphereHandler"/>

クラスで:

class NotificationsAtmosphereHandler {
  .....
  @Autowired
  SpringSecurityService springSecurityService
  .....
} 
于 2011-11-19T21:57:06.613 に答える
0

または、resources.groovy で Groovy の方法で実行します。

import package.NotificationsAtmosphereHandler

//...

notificationsAtmosphereHandler(NotificationsAtmosphereHandler) { bean ->
    bean.autowire = 'byName'
}

この方法では、@Autowired 表記も必要ありません。

于 2012-06-18T23:18:11.623 に答える