-
<?xml
version="1.0" encoding="UTF-8"?> -
<beans
xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
- xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:jee="http://www.springframework.org/schema/jee"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
-
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd -
http://www.springframework.org/schema/context -
http://www.springframework.org/schema/context/spring-context-2.5.xsd -
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd -
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd -
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> -
<context:property-placeholder
location="classpath:jdbc_config.properties"/> -
<!--
- DriverManagerDataSource:在每个连接请求时新建一个连接。
- SingleConnectionDataSource:在每个连接请求时都返回同一连接。
- -->
-
<bean
id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> -
<property
name="driverClassName" value="${driverClassName}"/> -
<property
name="url" value="${url}"/> -
<property
name="username" value="${username}"/> -
<property
name="password" value="${password}"/> -
</bean>
-
</beans>
。。。。。
-
<context:property-placeholder
location="classpath:dbcp_config.properties" /> -
<bean
id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" - destroy-method="close">
-
<property
name="driverClassName" value="${driverClassName}"/> -
<property
name="url" value="${url}"/> -
<property
name="username" value="${username}"/>