Spring IOC, DI, and springiocdi

Source: Internet
Author: User

Spring IOC, DI, and springiocdi

IOC (Inverse of Control) Control Inversion

Java is life. --------- we need to rent a house. at present, we do not need to find a specific landlord (new fangdong () Landlord object to rent his house fangdong. rent ()). if we are not satisfied with the landlord's house, it's too far away from the subway ..... heh. we also need to find the next landlord, new, and next landlord. the IOC container is like an intermediary with many houses in his hand. as long as we use this intermediary third party, we can choose the right housing. the existence of intermediary reduces the coupling between you and the landlord. the intermediary increases your fault tolerance,

Underlying Implementation of IOC: factory design mode + radiation + configuration file;

DI (Dependency Injection) Dependency Injection

Only the javabean managed by Spring (get objects through ioc) has dependency injection (self-created objects cannot be dependent on injection)

Dependency injection is a special implementation of IOC. We have implemented the coupling relationship between classes and classes. However, you also need to create a spring factory when getting the object. DI can dynamically inject dependent objects into bean components.

 

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.