Let's talk about the implementation principles of AOP and IOC.

Source: Internet
Author: User

IOC refers to the delivery of the Instance interface or instance class to the IOC container (if the factory mode is understood as an IOC, there is no problem)

AOP is the weaving technology. To put it bluntly, the desired effect is to insert the method dynamically before, during, and after the method is executed.

 

First, let's talk about AOP. In fact, the principle is very simple. It is to wrap the instance you returned and add the method before each method of the instance. If there is no IOC here, this implementation willProgramStaff exposed,

After IOC is added, it is perfect.

 

The process is that IOC goes to the Instance Object and calls the AOP program to repackage the object during the instance. The final object returned to the programmer is the encapsulated object, that's simple. There are many methods to achieve this.

The most typical is sprint.net, which is implemented by emit in reflection.

 

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.