@Async导致事务隔离
时间: 2023-09-30 22:11:38 浏览: 246
在Spring中,使用@Async注解可以实现异步方法调用,而@Transactional注解用于声明方法需要在事务中执行。然而,@Async和@Transactional注解不能同时使用在同一个方法上。这是因为多线程环境中,事务的隔离级别可能会受到影响,导致事务注解@Transactional失效。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [异步@Async + 事务@Transactional的结合](https://blog.csdn.net/u014748504/article/details/104389359)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [多线程下 @Async 注解导致 Spring 中的事务失效,该怎么办???](https://blog.csdn.net/weixin_38405253/article/details/124811395)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文