spring事务 rollbackfor
时间: 2023-10-20 12:03:37 浏览: 103
Spring事务的rollbackFor属性用于指定在哪些异常发生时需要进行事务回滚。如果没有指定rollbackFor属性,默认情况下,Spring只会对RuntimeException及其子类进行事务回滚。而对于Checked Exception和Error,Spring不会进行事务回滚。通过指定rollbackFor属性,可以扩展回滚的异常范围,使得在指定的异常发生时也能触发事务回滚操作。因此,rollbackFor属性的作用是告诉Spring在哪些异常发生时需要进行事务回滚。引用<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Spring事务管理——回滚(rollback-for)控制](https://blog.csdn.net/weixin_30316097/article/details/96675894)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [@Transactional使用](https://blog.csdn.net/zhaoyouliang123/article/details/102736778)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文