在生产环境实现配置文件和war包 的分离,为方便在必要的时候进行一定的更改,可以避免修改包,但是需要重启
最初为这样的选择配置,单不知为何未生效,修改为配置2配置方法,但不灵活,待跟进。
配置1:
<context:property-placeholderignore-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 值越小,优先级越高
原标题:配置文件,环境配置和war报分离,方便生产更改
关键词: