阅读Grails配置参数 [英] read Grails config parameter

查看:82
本文介绍了阅读Grails配置参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Config.groovy

storeFront.cms.endpoint = "http://10.60.33.51:27110/file_source"

I '试图读取它:

I'm trying to read it using:

ConfigurationHolder.config('storeFront.cms.endpoint')

我在某处阅读时应该使用 grailsApplication 变量来读取配置参数在标签库和控制器中是可用的,但在我的情况下,我试图从 src / groovy 下的类中读取它。

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.lang.String) values: [storeFront.cms.endpoint]


推荐答案

不应该是:

Shouldn't that be:

ConfigurationHolder.config.storeFront.cms.endpoint

Yeah ConfigurationHolder

这篇关于阅读Grails配置参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆