在生產環境實現配置文件和war包 的分離,為方便在必要的時候進行一定的更改,可以避免修改包,但是需要重啟 最初為這樣的選擇配置,單不知為何未生效,修改為配置2配置方法,但不靈活,待跟進。配置1: 配置2: <!-- 環境配置和war包分離 以外部配置為準--> 註:order 值越小,優先順序越高 ...
在生產環境實現配置文件和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 值越小,優先順序越高