0

我正在使用圣杯 2.2.4,

在 conf/spring/resources.xml 中,我尝试将文件导入为 ${realm}-config.properties,其中领域是 vm 参数,我尝试在 BuildConfig.groovy 中设置 vm 参数,如下所示

grails.tomcat.jvmArgs = ["-Dstage=dev","-Drealm=app"]

但它似乎没有起色。我得到以下错误,

类路径资源 [${realm}-config.properties] 无法打开,因为它不存在

在 grails 2.2.4 中设置 vm 争论的正确方法是什么?

4

1 回答 1

1

也许尝试通过 conf/Config.groovy 中处理的环境变量加载您的配置

def ENV_NAME = "MY_CONFIG"
grails.config.locations = []
if (System.getenv(ENV_NAME)) {
    grails.config.locations << "file:" + System.getenv(ENV_NAME)
}
else if (System.getProperty(ENV_NAME)) {
    grails.config.locations << "file:" + System.getProperty(ENV_NAME)
}
于 2015-12-23T12:08:07.423 回答