spring事务默认运行时异常回滚,RuntimeException

来源:互联网 发布:拳击直播软件 编辑:程序博客网 时间:2024/05/29 19:42

spring事务默认运行时异常回滚,RuntimeException

配置时添加异常回滚 rollback-for="Throwable" 


<aop:config>
<aop:pointcut id="transactionPointcut"
expression="execution(* com.dctrain.service..*.*(..))" />
<aop:advisor advice-ref="txAdvice"
pointcut-ref="transactionPointcut" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="save*" rollback-for="Throwable" />
<tx:method name="update*" rollback-for="Throwable" />
<tx:method name="delete*" rollback-for="Throwable" />
<tx:method name="*" read-only="true"
propagation="NOT_SUPPORTED" />
</tx:attributes>
</tx:advice>
0 0
原创粉丝点击