spring 加载外部资源文件/配置jdbc数据源
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sp="http://www.w3.org/2001/XMLSchema-instance"
sp:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.2.xsd
"
>
<bean id="holder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:com/spring/properties/jdbc.properties"></property>
</bean>
<context:property-placeholder location="classpath:com/spring/properties/jdbc.properties"/>
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" id="dataSource">
<constructor-arg index="0" value="${url}"></constructor-arg>
<constructor-arg index="1" value="${userName1}"></constructor-arg>
<constructor-arg index="2" value="${password}"></constructor-arg>
<property name="driverClassName" value="${driverClass}"></property>
</bean>
</beans>