配置druid连接池的文档
配置DataSource
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!--声明数据源DataSource,作用是连接数据库-->
<bean id="myDataSource" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="close">
<!--set注入给DruidDataSource提供连接数据库信息-->
<property name="url" value="jdbc:mysql://localhost:3306/springdb"></property>
<property name="username" value="root"></property>
<property name="password" value="root"></property>
<property name="maxActive" value="20"></property>
</bean>
</beans>