<?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" 
	xsi:schemaLocation="
				http://www.springframework.org/schema/beans
				http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
				http://www.springframework.org/schema/tx
				http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
				http://www.springframework.org/schema/aop 
 				http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">

	<!-- 数据库连接池 -->
	<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
		<property name="url" value="${spring.datasource.url}"/>
		<property name="username" value="${spring.datasource.username}"/>
		<property name="password" value="${spring.datasource.password}"/>
		<property name="validationQuery" value="SELECT 1 FROM DUAL"/>
	</bean>

	<!-- 配置事务管理器 -->
	<bean id="transactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>

	<!-- 开启aspectj注解 proxy-target-class为true表示使用cglib代理 为false表示使用jdk动态代理 -->
	<aop:aspectj-autoproxy proxy-target-class="true" />

	<tx:annotation-driven transaction-manager="transactionManager"/>

</beans>