开发者

read Grails config parameter

开发者 https://www.devze.com 2023-03-27 23:55 出处:网络
I\'ve added the following parameter in Config.groovy storeFront.cms.endpoint = \"http://10.60.33.51:27110/file_source\"

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

0

精彩评论

暂无评论...
验证码 换一张
取 消