The underlying implementation principle of Spring's AOP?

Dynamic proxy
aop is an extension function of ioc, first there is ioc, then there is aop, aop is just a new extension point in the whole process of ioc: BeanPostProcessor


General: aop concept, application scenarios, dynamic proxy
points:
        There is a step in the bean creation process that can extend the bean. Aop itself is an extended function, so it is implemented in the post-processing method of BeanPostProcessor


1. The process of creating a proxy object (advice, facet, point cut)

2. Generate a proxy object through jdk or cglib.
3. When executing a method call, it will call the generated bytecode file and directly return to the intercept method in the DynamicAdvisoredinterceptor class. From this method, it will be executed. 4. Generate an interceptor chain according to the previously defined notification. 5. Obtain each notification from the interceptor chain and start executing. The time starts from the position of -1 and executes it every
time
.

Guess you like

Origin blog.csdn.net/weixin_53031149/article/details/127490051