PropertyPlaceholderConfigurer加载属性配置文件:

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4        xmlns:p="http://www.springframework.org/schema/p"
 5        xsi:schemaLocation="
 6         http://www.springframework.org/schema/beans 
 7         http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 8 <!-- 使用spring提供的PropertyPlaceholderConfigurer读取数据库配置信息.properties -->
 9     <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
10         <property name="locations">
11             <list>
12                 <!--
13                     这里的classpath可以认为是项目中的src-属性名是 locations,
14                     使用子标签<list></list>可以指定多个数据库的配置文件,这里指定了一个
15                 -->
16                 <value>classpath:resource/config/jdbc.properties</value>
17             </list>
18         </property>
19     </bean>
20 </beans>
原文地址:https://www.cnblogs.com/hansongjiang/p/5666611.html