ICode9

精准搜索请尝试: 精确搜索
  • Spring事务不回滚的情况2022-08-04 12:05:36

    使用了@Transactional,并且代码中还添加了try{}catch{},那么事务就不会回滚。 默认spring事务只在发生未被捕获的 runtimeexcetpion时才回滚。   需要在catch里面加 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();  

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有