Spring容器是采用反射扫描的发现机制,通过标签的命名空间实例化实例,当Spring探测到容器中有一个org.springframework.beans.factory.config.PropertyPlaceholderCVonfigurer的Bean就会停止对剩余PropertyPlaceholderConfigurer的扫描,即只能存在一个实例。
那如果有多个配置文件怎么办呢?那就多个文件之间以“,”分隔,如下:
<context:property-placeholderlocation="classpath:db.properties,classpath:monitor.properties" />
或者 *通配符
<context:property-placeholderlocation="classpath:*.properties" />