转:http://hi.baidu.com/iduany/item/20f8f8ed24e1dec5bbf37df7 Spring AOP声明式事务异常回滚 近日测试用例,发现这样一个现象:在业务代码中,有如下两种情况,比如:throw new RuntimeException("xxxxxxxxxxxx"); 事物回滚throw new Exception("xxxxxxxxxxxx"); 事物没有回滚 自以为很了解事物,或许时间久远的缘故,没分析出来何故,遂查阅…
近日测试用例,发现这样一个现象:在业务代码中,有如下两种情况,比如:throw new RuntimeException("xxxxxxxxxxxx"); 事物回滚throw new Exception("xxxxxxxxxxxx"); 事物没有回滚 自以为很了解事物,或许时间久远的缘故,没分析出来何故,遂查阅了下资料,写下了如下的内容,供参考: 1).Spring的AOP即声明式事务管理默认是针对unchecked exception回滚.也就是默认对Runtim…
项目地址:git@github.com:witaste/transaction-annotation.git 情景一: A external method calls a method of the target object 外部方法调用目标对象的事务方法,异常逐层抛出,最终由a() 抛出,可以回滚. @Service public class FooServiceImpl implements FooService { @Autowired private FooMapper fooMap…