使用AopContext.currentProxy()时报错了.如下
Cannot find current proxy: Set 'exposeProxy' property on Advised to 'true' to make it available,and ensure that AopContext.currentProxy() is invoked in the same thread as the AOP invocation context.
看意思就是 没用设置 exposeProxy = true 这个参数.
解决:
@EnableAspectJAutoProxy(exposeProxy = true,proxyTargetClass = true)
更多详情可以参考
https://blog.csdn.net/mameng1988/article/details/85548812
https://blog.csdn.net/rtuujnncc/article/details/68926465
https://blog.csdn.net/z69183787/article/details/45622821/
https://blog.csdn.net/daofengsuoxiang/article/details/103027280
等等
另,通过this调用方法时,事务的失效也是因为这个原因.this调用拿到的并不是代理类,所以失效了.