context:property-placeholder 配置

spring的 context:property-placeholder 各种配置方式

  1. 配置一个文件:<context:property-placeholder location="classpath:jdbc.properties"/>这种方式不能写两行,我之前项目中有两个properties文件,我写了两行,但是第二个就是不被解析,所以这种方式只适应加载一个properties文件。
  2. 配置两个文件:<context:property-placeholder location="classpath*:jdbc.properties,classpath:c3p0.properties" />这种方式可以使用与加载2个以及2个以上的properties文件。使用与配置文件少,当然,一个配置文件也可以这样写。
  3. 配置多个文件:<context:property-placeholder location="classpath*:jdbc*.properties" />这种方式是用通配符匹配。

猜你喜欢

转载自linhexiao.iteye.com/blog/2239917
今日推荐