Main role: To solve code reuse, avoid the repetitive writing of code.
More typical scenarios: Log printing, permission validation, transaction processing
The reference URL is: http://moon-walker.iteye.com/blog/2381532
Spring AOP Related terminology
Facets : A class that is used to host notifications + Pointcuts. Integrate Where,when and how (where and when, when, and what to do)
tangency : Extracts the method that needs to be processed uniformly, and is a subset of the connection points. Solve the where problem, primarily filtered by pointcut expressions, such as typical configuration execution (* com.xxx.xxx.* (..))
Notifications : Troubleshoot when (and when), choose to use according to your business scenario:
Pre-notification (before): The method is called first before the target method executes
Post notification (after): The method is called after the target method has finished executing. Whether the target method executes successfully or throws an exception, it will be called.
return notification (afterreturning): The method is called after the target method has been successfully executed.
Exception Notification (afterthrowing): This method is called after the target method executes the throw exception
Surround notification (around): The target method of the package, in theory can be in the surround notification, to achieve the above 4 kinds of notifications.
Introduced
Weave into
Implementation method:
1. Annotation-based
2. XML-based configuration
3. Inject AspectJ slices
Spring's AOP understanding