<!-- 事务 -->
<!-- transactionManager平台事务管理器 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!-- aop管理事务
tx:advice:通知,增强
transaction-manager:事务管理器
tx:attributes,事务详情
tx:method:指定方法的详情
name:方法名称
-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="transfer" isolation="DEFAULT" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="myPiontuct" expression="execution(* com.gw.demo..*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="myPiontuct"/>
</aop:config>
转载于:https://my.oschina.net/u/3714511/blog/1557387