Spring导入多个properties文件
钢翼
编程
当导入多个properties文件时,如果直接写多个
<context:property-placeholder location="classpath:conf/XXX1.properties" /> <context:property-placeholder location="classpath:conf/XXX2.properties" />
会只加载第一个配置文件。
解决方法是每一个context:property-placeholder都加上 ignore-unresolvable="true"
<context:property-placeholder location="classpath:conf/XXX1.properties" ignore-unresolvable="true" /> <context:property-placeholder location="classpath:conf/XXX2.properties" ignore-unresolvable="true" />