Pre-notification in spring aop

< bean class= "org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" >

    <property name="beanNames">
        <list>
            <value>fixassetService</value><!-- service bean-->
        </list>
    </property>

    <property name="interceptorNames">
        <list>
            <value>myInterceptor</value>
            <value>myInterceptor2</value>
        </list>
     
    </property>
</bean>


I configured two interceptor in the configuration file above, and the logic in the invoke method of both interceptor is the same.
public Object invoke (MethodInvocation invo) throws Throwable {

/ / your own crosscutting logic
log.
invo.proceed ()

}

the question I want to ask is that the internal invo.proceed () method is executed when the invoke of the first interceptor is executed, which is essentially the method represented by our joinpoint (or the method that is inserted into crosscutting logic), and when interceptor2 executes the invoke method, it executes the invoke method of interceptor2, and executes invo.proceed () again, which causes the method represented by joinpoint to be executed twice?

do I understand it correctly?

May.16,2021

This is not the case. In fact, the execution relationship between the two agent notifications is not a sequential relationship, but a nested relationship.
your understanding is that the relationship between generating proxy class execution is:

  strengthen AOP  

Menu