A personal understanding of aspect-oriented programming (AOP) in spring

Source: Internet
Author: User

Programming AOP for Facets is a major feature of spring

Aspect Facets: A (Enhanced) class that encapsulates the functionality of a common feature

Advice by: A method of encapsulating enhancements in a slice class.

PointCut: A pointcut, is the concept of a collection that expresses using a regular expression

Before and after all the methods of all core business objects (transactional AOP typical applications)

Joinpoint: Connection point, where the program needs to join advice, and the ponitcut being executed

Weaving (Weaving): The process of integrating aspect and core business objects.

Implementing AOP through specific interfaces

Types of AOP Notifications:

Before: front-facing notification

After: Post notification

Around: Surround Notifications

Throwing: Exception notification

Here is a common example of life: cut watermelon = aspect-oriented programming AOP

Cut the watermelon first to have a knife, and this knife is like writing a need to cut the various methods

Configure the appropriate pointcuts in the configuration file

Then, cut down = Execute the program, when the program executes, the chopper (slice) becomes part of the watermelon (object) and is executed by a piece.

In the simplest sentence, the service layer is cut in half and the log and transaction commits are added.

A personal understanding of aspect-oriented programming (AOP) in spring

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.