@Transactional rollbackforName
时间: 2023-08-19 17:12:38 浏览: 57
回答: @Transactional注解中的rollbackFor属性用于指定哪些异常会触发事务回滚。当方法执行过程中抛出rollbackFor属性中指定的异常时,事务会回滚。如果没有指定rollbackFor属性,默认情况下,事务只会在遇到RuntimeException及其子类异常时回滚。如果需要在遇到非RuntimeException异常时也回滚事务,可以在rollbackFor属性中指定相应的异常类型。\[1\]
#### 引用[.reference_title]
- *1* *3* [spring transactional](https://blog.csdn.net/u013548106/article/details/123246971)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Spring知识总结](https://blog.csdn.net/weixin_42063820/article/details/118466715)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文