<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<bean id="dataSource1" class="org.apache.ibatis.datasource.pooled.PooledDataSource">
<property name="driver" value="${jdbc.driverClassName}"></property>
<property name="url" value="${jdbc.url1}"/>
<property name="username" value="${jdbc.username1}"/>
<property name="password" value="${jdbc.password1}"/>
<property name="poolMaximumIdleConnections" value="50"/>
<property name="poolMaximumActiveConnections" value="50"/>
<property name="poolPingConnectionsNotUsedFor" value="30"></property>
<property name="defaultTransactionIsolationLevel" value="2"></property>
<property name="poolPingQuery" value="select 1"></property>
<property name="poolPingEnabled" value="true"></property>
<property name="defaultAutoCommit" value="true"></property>
</bean>
<bean id="transactionManager1" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource1" />
</bean>
<tx:advice id="txAdvice1" transaction-manager="transactionManager1">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" rollback-for="exception"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="allServiceMethod1" expression="execution(* com.gm.service1..*(..))" />
<!-- 指定在txAdvice切入点应用txAdvice事务切面 -->
<aop:advisor advice-ref="txAdvice1" pointcut-ref="allServiceMethod1" order="1"/>
</aop:config>
<bean id="sqlSessionFactory1" class="org.mybatis.spring.SqlSessionFactoryBean" >
<property name="dataSource" ref="dataSource1" />
<property name="mapperLocations">
<list>
<value>classpath:com/db1/persistence/*.xml</value>
</list>
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.gm.dao1" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory1"></property>
</bean>
</beans>