-
Notifications
You must be signed in to change notification settings - Fork 45.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
关于事务传播行为中TransactionDefinition.PROPAGATION_NESTED案例描述错误 #2597
Comments
应该不会回滚吧?NESTED 适用:允许部分操作失败不影响整体事务(如日志记录失败不影响主业务)。 |
写了个demo验证了一下
结果如下: 【NESTED 适用:允许部分操作失败不影响整体事务】这句话按我的理解是嵌套子事务不会导致整体事务的回滚,前提是子事务bMethod()方法自己要处理异常或异常被外层aMethod()方法处理;
结果如下: 另外:在文章最后参考文章中Spring 事务传播行为详解也有场景验证,和我验证的结果一致; |
嗯嗯,不错的,费心了。如果可以的话,欢迎对这部分内容进行简单修正和完善,欢迎提交PR呀! |
好的,有时间我提交一下PR; |
bMethod()作为aMethod()的嵌套子事务,此时bMethod()出现异常,按照案例代码aMethod()应该会感知异常致使整体事务回滚;
Spring 事务详解
The text was updated successfully, but these errors were encountered: