the term
- Connection point: Which methods in a class can be enhanced, then these methods are called connection points (methods that can be enhanced are called connection points) , such as the above add(), update(), select(), delete( ) Can be called connection points
- Entry point: In fact, the enhanced method is called the entry point . For example, if only add() is enhanced, then add() can be called the entry point
- Notification (enhancement): The logical part of the actual enhancement is called notification (enhancement) . For example, if you want to add a log function to add(), then this log function can be called notification (enhancement)
- Aspect: It is an action that refers to the process of applying a notification to an entry point.
Notification (enhancement) has five types:
1. Pre-notification @Before is executed before the method (point-in point) is executed
2. Post-notification @After refers to The method (pointcut) is executed after execution (no matter whether an exception occurs or not)
3. Surround notification @Around can be executed before and after the method (pointcut)
4. Exception notification @AfterThrowing exception notification, only when the pointcut method Execute only when an exception occurs
5. Return notification @AfterReturning refers to the execution of the method (pointcut) after the return value is returned (it will not be executed if an exception occurs)
Pointcut expression:
Function: Explain which method of which class is the pointcut
format execution ([Access Modifier][Return Value Type][Full Path of Class][Method Name][Parameter Name])