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)