I understand AOP!



Supplement in front!

ApplicationContext container:

    When the container is created, all beans in the container are automatically created.

    Advantages: The system responds quickly.

    Insufficient: waste of system resources.

 

BeanFactory container:

    When the container is created, it does not automatically create any beans in the container . This bean is created by the container only when the bean is actually used .

    Advantage: saves system resources.

    Disadvantage: Relatively speaking, the system response speed is slow.

AOP

AOP , Aspect OrientProgramming , aspect-oriented programming. It is a concept and an idea, and there are many implementers, and Spring is one of the implementers.

         AOP is a complement to OOP . OOP considers the structure of a program from a static point of view, while AOP considers the running process of a program from a dynamic point of view.

         Spring is used to reduce coupling. IoC is used to reduce the coupling between the main business logic; AOP is used to reduce the coupling between the main business logic and the system-level service (cross-business logic), and the system-level service is woven into the main business logic at runtime.

         The underlying working principle of Spring 's AOP is to use dynamic proxies to enhance the main business. The dynamic proxy uses JDK 's Proxy and CGLIB two dynamic proxies.

Aspect _ _

Aspect is the cross business logic, which is the part to be enhanced to the main business. There are two common aspects in AOP programming: notification and advisor.

Weaving _ _

The process of cutting aspects into the main business logic is called weaving.

JoinPoint ( JoinPoint )

A target method in the target class of an aspect that can be woven into is called a join point.

Pointcut ( Pointcut )

The target method of the target class that is actually woven into the aspect is called a pointcut. A pointcut must be a join point.

target object ( Target )

The object to be enhanced is called the target object.

The object of the target class is the target object.

The object of the class where the main business logic is located is the target object.

Notice ( Advice )

It is a facet that can perform simple weaving functions. For example, you can specify a time point for weaving.

The notification can specify the time point of weaving, and the pointcut specifies the weaving position.

(1)   Advisor ( Advisor )

(2)   Introduction ( Introduction )

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325986110&siteId=291194637