分析这个问题需要先了解一个东西:ExposeInvocationInterceptor
1.从官方得到以下相关信息:
可以获知,当使用 AspectJ 时,spring 会添加一个连接器放到 advice 链的开头。但是为何要放这个东西呢?它是干嘛的?
2.看源码:
**
* Interceptor that exposes the current {@link org.aopalliance.intercept.MethodInvocation}
* as a thread-local object. We occasionally need to do this; for example, when a pointcut
* (e.g. an AspectJ expression pointcut) needs to know the full invocation context.
*
* <p>Don't use this interceptor unless this is really necessary. Target objects should
* not normally know about Spring AOP, as this creates a dependency on Spring API.
* Target objects should be plain POJOs as far as possible.
*
* <p>If used, this interceptor will normally be the first in the interceptor chain.
*
* @author Rod Johnson
* @author Juergen Hoeller
*/
@SuppressWarnings("serial")
public class ExposeInvocationInterceptor implements MethodInterceptor, PriorityOrdered, Serializable {
/** Singleton instance of this class */
public static final ExposeInvocationInterceptor INSTANCE =