Cannot find current proxy: Set ‘exposeProxy‘ property on Advised to ‘true‘ to make it available.

港控/mmm° 2023-01-22 15:00 40阅读 0赞

出现这个报错通常是因为使用了AopContext.currentProxy()函数却没有添加相应的配置造成的。

通过注解添加配置(加在类上):

  1. @EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)

或通过xml配置文件添加配置:

  1. <aop:aspectj-autoproxy proxy-target-class="true" expose-proxy="true"/>

这样就解决了报错问题。

发表评论

表情:
评论列表 (有 0 条评论,40人围观)

还没有评论,来说两句吧...

相关阅读