spring事务
2016-03-08 13:47
120 查看
<!-- 事务相关配置 -->
<tx:advice id="txdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="delete*" propagation="REQUIRED" read-only="false"
rollback-for="java.lang.Exception" no-rollback-for="java.lang.RuntimeException"/>
<tx:method name="insert*" propagation="REQUIRED" read-only="false"
rollback-for="java.lang.RuntimeException" />
<tx:method name="update*" propagation="REQUIRED" read-only="false"
rollback-for="java.lang.Exception" />
<tx:method name="find*" propagation="SUPPORTS"/>
<tx:method name="get*" propagation="SUPPORTS"/>
<tx:method name="select*" propagation="SUPPORTS"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="pc" expression="execution(public * org.ssm.services.impl.*.*(..))" /> <!--把事务控制在Service层-->
<aop:advisor pointcut-ref="pc" advice-ref="txdvice" />
</aop:config>
<context:component-scan base-package="org.ssm.services.impl"
name-generator="org.ssm.overwrite.spring.ServicesNameGenerator"
use-default-filters="false"
annotation-config="false">
<context:include-filter type="regex" expression=".*Impl"/>
</context:component-scan>
<tx:advice id="txdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="delete*" propagation="REQUIRED" read-only="false"
rollback-for="java.lang.Exception" no-rollback-for="java.lang.RuntimeException"/>
<tx:method name="insert*" propagation="REQUIRED" read-only="false"
rollback-for="java.lang.RuntimeException" />
<tx:method name="update*" propagation="REQUIRED" read-only="false"
rollback-for="java.lang.Exception" />
<tx:method name="find*" propagation="SUPPORTS"/>
<tx:method name="get*" propagation="SUPPORTS"/>
<tx:method name="select*" propagation="SUPPORTS"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="pc" expression="execution(public * org.ssm.services.impl.*.*(..))" /> <!--把事务控制在Service层-->
<aop:advisor pointcut-ref="pc" advice-ref="txdvice" />
</aop:config>
<context:component-scan base-package="org.ssm.services.impl"
name-generator="org.ssm.overwrite.spring.ServicesNameGenerator"
use-default-filters="false"
annotation-config="false">
<context:include-filter type="regex" expression=".*Impl"/>
</context:component-scan>
相关文章推荐
- ArrayList Iterator remove java.lang.UnsupportedOperationException
- Maven + Spring 简单示例
- JVM(Java虚拟机)
- Java类加载
- Java获取客户端(浏览器)的MAC地址
- java 图片裁剪
- 使Mac系统下的eclipse支持GBK GB2312编码
- java设计模式学习笔记第五章
- 《Java实战开发经典》第六章6.5
- JAVA往字符串中某位置加入一个字符串
- SpringMVC联手REST实现入门级的CRUD
- eclipse mvn build error tips
- java写简易五子棋游戏。
- Myeclipse中安装svn
- java程序设计基础_陈国君版第五版_第四章习题
- Eclipse的maven构建一个web项目,以构建SpringMVC项目为例
- 将java源码打成jar包
- 从上往下打印二叉树
- java程序设计基础_陈国君版第五版_第四章例题
- (java)Subsets II