What is the concept of AOP?
This article mainly explains "what is the concept of AOP". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the concept of AOP".
What is AOP?
That is, aspect-oriented programming is a supplement and improvement of OOP, which is not conducive to the reuse of each module due to the repetition of a large amount of code in OOP, while AOP technology uses a technology called "crosscutting" to unravel the interior of encapsulated objects, and encapsulate the common behaviors that affect multiple classes into a reusable module, which is named "Aspect". The so-called "aspect" simply means that the logic or responsibility that has nothing to do with the business but is jointly invoked by the business module is encapsulated in order to reduce the repetitive code of the system and reduce the coupling between the modules. it improves the maneuverability and maintainability of the software.
II. Several concepts of Spring AOP
The basic concept of AOP
(1) Aspect (aspect): defines an aspect class that defines pointcuts and Advice (@ Before,@After, etc.), which is an abstraction of crosscutting concerns.
(2) JointPoint (join point): a clear point in the execution of a program, usually a call to a method, or a field or rule constructor.
(3) Advice (Notification): that is, what is the cut-in mode before? After that? , including @ Before,@After,@AfterReturning,@AfterThrowing,@Around, etc.
(4) Pointcut (pointcut): a join point with notification, which is mainly embodied in writing pointcut expressions in the program.
(5) AOP proxy: the object created by the AOP framework, and the proxy is the reinforcement of the target object. AOP agents in Spring can make JDK dynamic agents or CGLIB agents, the former based on interface and the latter based on subclasses
(6) Target object: the target object of the agent
(7) Waving: the process of applying a section to the target object and causing the proxy object to be created
(8) Introduction (introduction): without modifying the code, some methods or fields can be dynamically added to the class at run time
Thank you for your reading, the above is the content of "what is the concept of AOP", after the study of this article, I believe you have a deeper understanding of what the concept of AOP is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!