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

时间:2020-07-07 09:59:33   收藏:0   阅读:592

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

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

@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)

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

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

这样就解决了报错问题。

 

"祝你早安午安晚安。"

原文:https://www.cnblogs.com/yanggb/p/13227072.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!