【发布时间】:2016-01-16 01:15:24
【问题描述】:
我正在使用 PropertyPlaceholderConfigurer 在我的 Spring WebApplication 中加载属性文件,如下所示:
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:db.properties</value>
<value>classpath:mail.properties</value>
</list>
</property>
</bean>
现在,我想覆盖 mail.properties 中的一些属性,所以我在我的 application-context 文件中创建了一个额外的条目来读取这个 post,如下所示:
<context:property-placeholder location="file:override.properties"
order="-1" ignore-unresolvable="true" ignore-resource-not-found="true" />
然后,在我的 Tomcat Server 中,在启动配置的 VM Arguments 中,我提供了额外的条目:
-Dexternal.props="/Users/ArpitAggarwal/Desktop/override.properties"
对于一些我必须覆盖的键的覆盖值。
但是,WebApp 没有获取来自override.properties 的值。谁能帮我弄清楚我错过了什么。
任何帮助将不胜感激。谢谢!
【问题讨论】:
标签: java spring spring-mvc tomcat properties-file