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

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -