exposeProxy
Set whether the proxy should be exposed by the AOP framework as a ThreadLocal for retrieval via the AopContext class. This is useful if an advised object needs to call another advised method on itself.
AopContex.currentProxy()
一、
@EnableAsync(mode=AdviceMode.PROXY) AsyncAnnotationBeanPostProcessor.
setExposeProxy(true)
Note that if the mode is set to AdviceMode.ASPECTJ
, then the value of the proxyTargetClass
attribute will be ignored. Note also that in this case the spring-aspects
module JAR must be present on the classpath, with compile-time weaving or load-time weaving applying the aspect to the affected classes. There is no proxy involved in such a scenario; local calls will be intercepted as well.
二、
@EnableAspectJAutoProxy(exposeProxy = true) AnnotationAwareAspectJAutoProxyCreator