Spring's AOP understanding

Source: Internet
Author: User
Tags aop throw exception

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.