Aop
Aspect Oriented Programming, when the program is running, without changing the source code of the program, the function of dynamic enhancement methods.
concept | Explanation |
---|---|
Cut-off point | To add code places |
Notification / enhancement | Dynamically add code to the tangent point |
section | Cut-off point + notification |
Junction | Defined cut-off point |
Aop implementation
- cglib
- jdk
Aop notification type
- @Before: pre-notification, to operate before the target method is executed.
- @After: Rear notification, an operation performed after the target method.
- @Around: Surround notification, an operation performed after and before the target method.
- @AfterThrowing: exception is thrown notice, the program operates when an exception occurs.
- @AfterReturning: Returns the notice, the target method returns a value of time will trigger.