我正在开发一个Spring应用程序,其中的属性文件将打包在.war文件中进行部署。如何在Spring中加载属性文件位置的系统属性
<context:property-placeholder location="classpath:application.properties" />
不过,我想能够与可在standalone.xml被指定为系统属性另一个文件覆盖它们:
</extensions>
<system-properties>
<property name="CONFIG_FILE_LOCATION" value="/path/to/application.properties"/>
</system-properties>
这是我的解决方案,
<context:property-placeholder location="classpath:application.properties,
file:///${CONFIG_FILE_LOCATION}" />
但显然春无法找到它
Caused by: java.io.FileNotFoundException: ${CONFIG_FILE_LOCATION} (The system cannot find the file specified)
有没有人有任何想法我可以修复它? Spring是否有另一种方式访问系统属性?
这是实际工作,这是我的错,因为我是与做错standalone.xml版本开始没有配置属性。 – aUserHimself