read Grails config parameter
I've added the following parameter in Config.groovy
storeFront.cms.endpoint = "http://10.60.33.51:27110/file_source"
I'm trying to read it using:
ConfigurationHolder.config('storeFront.cms.endpoint')
I read somewhere that configuration parameters should be read using the grailsApplication
variable that is available in taglibs and controllers, but in my case I'm trying to read it from a class under src/groovy
.
When the application starts up I get the error:
groovy.lang.MissingMethodException: No signature of method: groovy.util.ConfigObject.call()
is applicable for argument types: (java.lan开发者_Python百科g.String) values: [storeFront.cms.endpoint]
Shouldn't that be:
ConfigurationHolder.config.storeFront.cms.endpoint
And yeah ConfigurationHolder
is deprecated in Grails 2.0
精彩评论