Principles of aop in Spring and Springaop

Source: Internet
Author: User

Principles of aop in Spring and Springaop

FeaturesFor Aspect-Oriented aop, you do not need to modify the source code for the extended functions.

AOP is short for Aspect Oriented Programming.

Aop adopts a horizontal extraction mechanism to replace the repetitive code of the traditional vertical Inheritance System

We have implemented the add () method to add new users to the database ()

Later, we found that the function needed to be extended, that is, after adding a new user, we need to record the added time and the user

The most primitive method is to directly modify the source code, the red letter in the image, but this is the original structured programming idea, not conducive to program Expansion

By inheriting the parent class and using the super (point) parent class method, add the log function to the subclass Method

(Personal opinion) or parent-child exchange,

(Personal opinion) or inherit the subclass to obtain the add () method. Create an addWithLog () method in the subclass.

 

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.