Introduction to IOC and AOP

Source: Internet
Author: User


IoC control inversion, also known as dependency inversion. The code does not directly connect to objects and services, but describes in the configuration file which component requires which service. The container is responsible for linking these together. In traditional development, always the keynote side must actively integrate the tuned side during the coding period, and the IOC realizes a more similar, the tuned side in the run process and then according to the configuration information to match the keynote side.

Both of these design patterns are implemented in Java using reflection.

The core benefit of these two design patterns is that they provide a very flexible component integration approach, where developers are free to assemble components, develop in-between interfaces, add packaging or decorations at will, and so on, so that the parts of the business logic can be isolated, Thus, the coupling degree between the parts of business logic is reduced, the reusability of the program is improved, and the efficiency of the development is improved.

After spring, what do you do with it? It's the business class. When a ClassA object is needed, the spring IOC container is created to create the ClassA object, which is then injected into the business class where it is needed. This shows the meaning of control inversion. That is, creating this ClassA object is actively created by the business class and changed to passively accept the injection of the spring IOC container.


This kind of thought is the aspect-oriented thought, it is actually a complement to the object-oriented thought.

Introduction to IOC and AOP

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.