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


出現這個報錯通常是因為使用了AopContext.currentProxy()函數卻沒有添加相應的配置造成的。

通過注解添加配置(加在類上):

@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)

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

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

這樣就解決了報錯問題。

 

"祝你早安午安晚安。"


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM