Spring dbcp配置

来源:互联网 发布:淘宝待发货订单生成器 编辑:程序博客网 时间:2024/05/17 22:12
<?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:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-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/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/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">


<!-- 组件自动扫描技术 -->
<context:component-scan base-package="org.tarena.*" />
<!-- 启用AOP注解 -->
<aop:aspectj-autoproxy />

<!-- DPCP配置-->
<bean id="jdbcDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="username" value="liupeng"/>
<property name="password" value="liupeng"/>
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/liu"/>
<property name="maxActive" value="20"/>
<property name="initialSize" value="2"/>
</bean>

</beans>


需要导入如下3个jar包到lib目录下

commons-collections-3.1.jar

commons-dbcp-1.2.2.jar

commons-pool.jar

0 0
原创粉丝点击