IOC control reversal

Source: Internet
Author: User

The IOC control reversal is embodied in two concepts in terms of: 1, control 2, inversion

Control: What exactly does it take to control? A: The control of the Create object, that is, the implementation of a specific interface to select control of the class .

Reversal: Who was the original control?    Who should be given control? A: Generally we use what object directly in the call class new, then the first control is to call the class. Then give control to a third party to decide.


The IOC is not straightforward enough, so the industry has been extensively discussed, and eventually the software world's leading figure Martin Fowler proposed the concept of Di (Dependency injection: Dependency injection) to replace the IOC

DI Dependency Injection: The dependency of the calling class on an interface implementation class is injected by a third party (container or collaboration Class) to remove the invocation class's dependency on an interface implementation class.

(container or collaboration class) such as the Bean container in spring:

<?XML version= "1.0" encoding= "UTF-8"?>  <Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xmlns:p= "http://www.springframework.org/schema/p"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0 . xsd ">     <BeanID= "Interface Class"class= "Implementation Class"/>     <BeanID= "Call class ID"class= "Call class"P: interface class-ref= "Interface Class"/></Beans> 

IOC control reversal

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.