java.lang.IllegalStateException: 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.....

1、在执行LoginService loginService = (LoginService) AopContext.currentProxy();代码,报下面的错误,该如何解决

1
java.lang.IllegalStateException: 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.    at org.springframework.aop.framework.AopContext.currentProxy(AopContext.java:69)

 

解决办法:

  在启动类加加上 @EnableAspectJAutoProxy(exposeProxy = true)

 

posted @   信铁寒胜  阅读(123)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
历史上的今天:
2022-12-02 POI插入行,合并行的单元格
2021-12-02 Eclipse的知识积累
点击右上角即可分享
微信分享提示