|
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
|
|
|
xmlns:context="http://www.springframework.org/schema/context"
|
|
|
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
|
|
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
|
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
|
|
|
http://www.springframework.org/schema/mvc
|
|
|
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
|
|
|
http://www.springframework.org/schema/context
|
|
|
http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
|
|
http://www.springframework.org/schema/aop
|
|
|
http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
|
|
|
http://www.springframework.org/schema/tx
|
|
|
http://www.springframework.org/schema/tx/spring-tx-4.1.xsd ">
|
|
|
|
|
|
<!-- 事务管理器
|
|
|
对mybatis操作数据库事务控制,spring使用jdbc的事务控制类
|
|
|
-->
|
|
|
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
|
|
<!-- 数据源
|
|
|
dataSource在applicationContext-dao.xml中配置了
|
|
|
-->
|
|
|
<property name="dataSource" ref="dataSource"/>
|
|
|
</bean>
|
|
|
|
|
|
<!-- 通知 -->
|
|
|
<tx:advice id="txAdvice" transaction-manager="transactionManager">
|
|
|
<tx:attributes>
|
|
|
<!-- 传播行为 -->
|
|
|
<tx:method name="save*" propagation="REQUIRED"/>
|
|
|
<tx:method name="delete*" propagation="REQUIRED"/>
|
|
|
<tx:method name="insert*" propagation="REQUIRED"/>
|
|
|
<tx:method name="update*" propagation="REQUIRED"/>
|
|
|
<tx:method name="find*" propagation="SUPPORTS" read-only="true"/>
|
|
|
<tx:method name="get*" propagation="SUPPORTS" read-only="true"/>
|
|
|
<tx:method name="select*" propagation="SUPPORTS" read-only="true"/>
|
|
|
</tx:attributes>
|
|
|
</tx:advice>
|
|
|
|
|
|
</beans> |