unable inject grails app context in src/groovy -
i have created custom event listener extends abstractpersistenceeventlistener described in grails docs http://grails.org/doc/latest/guide/gorm.html , works fine, however. unable inject service in listener if doing follows.
def context = servletcontextholder.servletcontext.getattribute(grailsapplicationattributes.application_context) def myservice = context.myservice
the 'context' returns null.
any ideas may problem. thank p.s. grails 2.1.2
pass in applicationcontext listener constructor argument when register it.
Comments
Post a Comment