How to access Grails configuration in Grails 2.0?

后端 未结 6 2050
青春惊慌失措
青春惊慌失措 2020-11-30 18:35

I have obtained the latest Grails 2.0 milestone, and I am seeing a deprecation warning for the ConfigurationHolder class:

org.codehaus.groovy.gr         


        
6条回答
  •  盖世英雄少女心
    2020-11-30 19:30

    An alternative to grailsApplication is the Holders class,

    import grails.util.Holders
    
    def config = Holders.config
    

    You get config directly off of Holders, no injection needed, which is nice for utility classes, etc.

提交回复
热议问题