配置文件,環境配置和war報分離,方便生產更改


在生產環境實現配置文件和war包 的分離,為方便在必要的時候進行一定的更改,可以避免修改包,但是需要重啟

最初為這樣的選擇配置,單不知為何未生效,修改為配置2配置方法,但不靈活,待跟進。
配置1:

<context:property-placeholder
ignore-resource-not-found="true"
location="file:${CONF_PATH}/${sysconfig.properties.file},classpath*:/${sysconfig.properties.file}" />

配置2:
<!-- 環境配置和war包分離 以外部配置為准-->

<context:property-placeholder 
order="1" 
ignore-resource-not-found="true"
ignore-unresolvable="true" 
location="file:${CONF_PATH}/${sysconfig.properties.file}" />

<context:property-placeholder 
order="2" 
ignore-resource-not-found="true" 
ignore-unresolvable="false"
location="classpath*:/${sysconfig.properties.file}" />

 

注:order 值越小,優先級越高


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM