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();代码,报下面的错误,该如何解决

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 @ 2024-12-02 14:17  信铁寒胜  阅读(16)  评论(0编辑  收藏  举报