Spring5 Study Notes (2) - "Spring IOC (Inversion of Control) Overview"


1. Overview of Spring-IOC

1. What is IOC

IOC (Inversion of Control) is the foundation of the Spring framework, on which AOP and declarative transactions are implemented. After using the IOC container, developers do not need to care about how the container runs, nor do they need to call the container API. The container will automatically initialize the managed objects and complete the maintenance of dependencies between objects .

(1)把对象创建和对象之间的调用过程,交给Spring进行管理
(2)使用IOC目的:为了降低耦合度

2. IOC bottom layer

xml parsing, factory pattern, reflection

3. Two ways of IOC container implementation provided by Spring (two interfaces)

(1) BeanFactory接口: The basic implementation of the IOC container is the use interface of the Spring internal interface, which is not provided for developers to use (the object will not be created when the configuration file is loaded, and the object will be created when the object is obtained .)

​ (2) ApplicationContext接口: The sub-interface of the BeanFactory interface provides more and more powerful functions for developers to use (the configuration file object will be created when the configuration file is loaded )Recommended Use!

Guess you like

Origin blog.csdn.net/qq_47354826/article/details/120448276