配置文件,环境配置和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