当前位置:网站首页>service事物失效如何获取代理事物
service事物失效如何获取代理事物
2022-07-29 17:21:00 【垂钓的小鱼1】
在我们项目中有事物失效的情况
在一个没用开启事物的方法中调用另外一个开启了事物的方法,在调用createVoucherOrder方法的时候是通过this去调用的,并不是通过代理对象调用,所以事物失效,此时我们应该是通过代理对象来调用
该如何做呢
添加maven依赖
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
在启动类里面添加一个注解@EnableAspectJAutoProxy(exposeProxy = true),开启adpectj代理
@EnableAspectJAutoProxy(exposeProxy = true)
@MapperScan("com.hmdp.mapper")
@SpringBootApplication
public class HmDianPingApplication {
public static void main(String[] args) {
SpringApplication.run(HmDianPingApplication.class, args);
}
}
如此事物生效了
边栏推荐
- Internet Explorer 结束了它 26 年作为顶级浏览器的历史角色
- 接口内容01文档:postman学习路线
- 抗HER2/neu受体拟肽修饰的紫杉醇自蛋白纳米粒/环境敏感型多糖纳米粒的制备,
- [网络]路由BGP
- When to use UserCF and when to use ItemCF?
- STC8h1k28六个基本实验
- 地球超2亿蛋白质结构全预测,AlphaFold引爆「蛋白质全宇宙」
- Babbitt | Metaverse Daily Must Read: Seven consecutive quarters of losses, Meta Metaverse division Q2 loss of $ 2.8 billion, Zuckerberg said this situation may continue for years ...
- 观点:灵魂绑定NFT和去中心化社会
- Flutter dynamic | Fair server new version features
猜你喜欢
随机推荐
常见的磁盘格式以及它们之间的区别
泰山OFFICE技术讲座:影响文字效果的因素,由四大升级为五大
抗HER2/neu受体拟肽修饰的紫杉醇自蛋白纳米粒/环境敏感型多糖纳米粒的制备,
如何让照片中的人物笑起来?HMS Core视频编辑服务一键微笑功能,让人物笑容更自然
large number factorial calculation
NFTScan and PANews jointly release multi-chain NFT data analysis report
提高编程效力的5大VS Code Extensions
地球超2亿蛋白质结构全预测,AlphaFold引爆「蛋白质全宇宙」
The Huazhong Agricultural University team proposes: a heterogeneous network-based method that can automatically extract meta-paths and predict drug-target interactions
Weekend Sharing - About WeChat Ecological Changes and 5G
多线程顺序运行的 4 种方法,面试随便问!
MySQL数据库基础
“大龄”裸辞的“孤勇者”们
Chicken and rabbit in the same cage
Interface Project 02 Documentation: Jmeter Interface Testing and Performance Testing
【微信小程序】组件使用及属性参考
【WeChat Mini Program】Zero Basic Learning | Mini Program Grammar
LinkedList 5-141. The circular linked list
观点:灵魂绑定NFT和去中心化社会
Query term weights, search term weighting