spring aop xml配置事务
2017-05-03 14:54
176 查看
<aop:config>
<!-- 通过aop定义事务增强切面-->
<aop:pointcut id="serviceMethod" expression="execution(* cc.zeelan.app.service..*.*(..))" />
<!--事务增强-->
<aop:advisor pointcut-ref="serviceMethod" advice-ref="txAdvice" />
</aop:config>
<!--事务增强 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<!-- 事务属性定义 -->
<tx:attributes>
<!-- 读取事务 -->
<tx:method name="query*" propagation="SUPPORTS" read-only="true" timeout="600"/>
<tx:method name="find*" propagation="SUPPORTS" read-only="true" timeout="600"/>
<tx:method name="get*" propagation="SUPPORTS" read-only="true" timeout="600"/>
<tx:method name="select*" propagation="SUPPORTS" read-only="true" timeout="600"/>
<tx:method name="sum*" propagation="SUPPORTS" read-only="true" timeout="600"/>
<!-- 操作事务 -->
<tx:method name="add*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
<tx:method name="inse*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
<tx:method name="del*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
<tx:method name="update*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
<tx:method name="edit*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
<tx:method name="task*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
</tx:attributes>
</tx:advice>
<!-- 通过aop定义事务增强切面-->
<aop:pointcut id="serviceMethod" expression="execution(* cc.zeelan.app.service..*.*(..))" />
<!--事务增强-->
<aop:advisor pointcut-ref="serviceMethod" advice-ref="txAdvice" />
</aop:config>
<!--事务增强 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<!-- 事务属性定义 -->
<tx:attributes>
<!-- 读取事务 -->
<tx:method name="query*" propagation="SUPPORTS" read-only="true" timeout="600"/>
<tx:method name="find*" propagation="SUPPORTS" read-only="true" timeout="600"/>
<tx:method name="get*" propagation="SUPPORTS" read-only="true" timeout="600"/>
<tx:method name="select*" propagation="SUPPORTS" read-only="true" timeout="600"/>
<tx:method name="sum*" propagation="SUPPORTS" read-only="true" timeout="600"/>
<!-- 操作事务 -->
<tx:method name="add*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
<tx:method name="inse*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
<tx:method name="del*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
<tx:method name="update*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
<tx:method name="edit*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
<tx:method name="task*" propagation="REQUIRED" read-only="false" rollback-for="Exception"/>
</tx:attributes>
</tx:advice>
相关文章推荐
- Spring之AOP声明式事务管理(采用xml的配置方式更好)
- applicationContext-common.xml 之spring tx:advice 和 aop:config 配置事务属性详解
- applicationContext-common.xml 之spring tx:advice 和 aop:config 配置事务属性详解
- applicationContext-common.xml 之spring tx:advice 和 aop:config 配置事务属性详解
- applicationContext-common.xml 之spring tx:advice 和 aop:config 配置事务属性详解
- spring context.xmL配置数据库事务以及aop
- Spring2.X以AspectJ 式AOP 配置事务
- Spring 声明式事务管理 Annotation配置 xml文件
- Spring 2.0 AOP 与事务配置
- 又碰到问题了...附spring事务的xml配置
- spring的aop事务配置
- Spring 采用基于XML方式配置事务
- spring配置文件application.xml中的事务总结
- SSH整合-关于Spring中applicationContext.xml文件对于事务的一些配置
- Spring Aop实现——Annotation方式(注解式)and Schema-based式(xml配置)
- 又碰到问题了...附spring事务的xml配置(转)
- Spring的AOP使用xml配置
- spring tx:advice 和 aop:config 配置事务
- spring配置文件applicationContext.xml中的事务总结
- Spring视频学习(十)使用XML配置事务