使用本地属性文件覆盖Spring 3.1中的属性

Ash*_*ell 3 deployment spring properties

我试图使用我正在部署的框上的本地属性文件覆盖我的war文件中找到的默认值.

<context:property-placeholder
  location="classpath*:*.properties, file:/var/myfolder/local.properties"
  ignore-resource-not-found="true"
  ignore-unresolvable="true" />
Run Code Online (Sandbox Code Playgroud)

我已经看到这可以通过提供一个文件作为第二个位置(逗号分隔)来实现.不幸的是,它似乎没有覆盖属性.

我已经尝试使用属性定义bean和设置位置,但这也不起作用.

Man*_*noj 11

一种方法是将它们分成两个并使用顺序

<context:property-placeholder
  location="classpath*:*.properties"
  ignore-resource-not-found="true"
  ignore-unresolvable="true"
  order ="0" />

<context:property-placeholder
  location="file:/var/myfolder/local.properties"
  ignore-resource-not-found="true"
  ignore-unresolvable="true"
  order="-1"/>
Run Code Online (Sandbox Code Playgroud)

最低顺序优先