我加載如下使用PropertyPlaceholderConfigurer
性質在我的春節WebApplication
文件:替代屬性在Spring Web應用程序文件在運行時
<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
。任何人都可以幫助我搞清楚,我錯過了什麼。
任何幫助將不勝感激。謝謝!
這使得必須從服務器提供'override.properties'作爲'vm arg'。 – Arpit