Search code examples
grailsatmosphere

Injecting service into Grails Atmosphere Handler class


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.


Solution

  • resources.xml:

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

    in class:

    class NotificationsAtmosphereHandler {
      .....
      @Autowired
      SpringSecurityService springSecurityService
      .....
    }