Access grailsApplication or Service in groovy class

后端 未结 4 779
长情又很酷
长情又很酷 2021-02-14 15:20

I am trying to access grailsApplication in groovy class under src/groovy but I get a null pointer exception. I also tried to inject a service into the

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-14 15:58

    After Grails 2.0, you should use:

     def grailsApplication = Holders.grailsApplication
    

提交回复
热议问题