ensure that AopContext.currentProxy() is invoked in the same thread as the AOP invocation context

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.

在spring boot 的启动类上加上注解: @EnableAspectJAutoProxy(proxyTargetClass=true,exposeProxy=true) 也可以
@EnableAspectJAutoProxy(proxyTargetClass=false,exposeProxy=true)

proxyTargetClass=false 表示用jdk动态代理 为true 表示 cglib动态代理
posted @ 2020-11-12 16:44  会游泳的小猪  阅读(1919)  评论(0)    收藏  举报