@EnableTransactionManagement可以省略吗
时间: 2023-11-07 18:15:14 浏览: 139
是的,@EnableTransactionManagement注解可以省略。在Spring Boot项目中,如果你使用了Spring Boot的默认配置和依赖,它会自动为你开启事务管理功能,无需手动添加@EnableTransactionManagement注解。这是因为Spring Boot会根据类路径下的相关依赖自动配置事务管理器。因此,在大多数情况下,你不需要显式地添加@EnableTransactionManagement注解来启用事务管理功能。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Spring 事务原理篇:@EnableTransactionManagement注解底层原理分析技巧,就算你看不懂源码,也要学会这个...](https://blog.csdn.net/avengerEug/article/details/118584174)[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%"]
- *2* *3* [SpringBoot项目为什么不需要添加@EnableTransactionManagement了](https://blog.csdn.net/suifengyangerqu/article/details/127062719)[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 ]
阅读全文