[Js-spring] Spring vs. IOC (control inversion, inversion of controls)

Source: Internet
Author: User

Controlled inversion (ioc,inversion of Control), is a concept, an idea. Refers to the object that is traditionally manipulated directly by the program code to the container, through the container to achieve the assembly and management of the object. Control inversion is the transfer of control over objects, which is reversed from the program code itself to the outer container.

IOC is a concept, a kind of thought, the way of realization is various. There are two types of implementations that are currently popular: Dependency Injection and Dependency lookup. The application of dependency injection is more extensive.

    •   Dependency Lookup (Dependency lookup,dl): The container provides callback interfaces and context to the component, and the program code needs to provide a specific way to find it. It is more typical to rely on the lookup of the Jndi service interface (Java naming and Directory Interface).
    •   Dependency Injection (Dependency injection,di): The program code does not do the location query, these tasks are done by the container itself.

Dependency Injection DI refers to the process of running a program, if you need to invoke another object assistance, you do not need to create the callee in code, but rather rely on the external container, created by the external container and passed to the program.

Spring's dependency injection has virtually no requirement for callers and callers to fully support the management of dependency between POJO.

  Dependency Injection is by far the best decoupling method . Dependency Injection lets Spring's beans be organized together in a configuration file, rather than being coupled in a hard-coded fashion.

[Js-spring] Spring vs. IOC (control inversion, inversion of controls)

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.