spring xml引入多个配置文件

2020-01-17  本文已影响0人  李中凯_f395

spring的xml中引入单个配置文件

<context:property-placeholder location="classpath:release/jdbc.properties" />

spring的xml中引入多个配置文件(需要加ignore-unresolvable="true")

//模糊匹配
<context:property-placeholder location="classpath:release/*.properties" ignore-unresolvable="true"/>
//精准匹配
<context:property-placeholder location="classpath:release/jdbc.properties,classpath:release/config.properties,classpath:release/ireport.properties" ignore-unresolvable="true"/>

需要注意的是context:property-placeholder标签只能出现一次,所以如果在xml中配置多个context:property-placeholder,spring默认只识别第一个

上一篇 下一篇

猜你喜欢

热点阅读