1. What is IOC
Inversion of Control (IoC) is an important object-oriented programming principle to reduce the coupling problem of computer programs, and it is also the core of the lightweight Spring framework. Inversion of control is generally divided into two types, Dependency Injection ( DI ) and Dependency Lookup. Dependency injection is widely used.
.IOC: Inversion of control, transfer of control, the application itself is not responsible for the creation and maintenance of dependent objects, but the external container is responsible for the creation and maintenance
.DI (Dependency Injection) is one of its implementations
. Purpose: Create objects and assemble relationships between objects
The process of getting dependent objects is reversed
2. Initialize the Bean container
Two basic packages:
org.springframework.beans
org.springframework.context
BeanFactory provides configuration structure and basic functions, loads and initializes Bean container
ApplicationContext holds Bean objects and is widely used in Spring
way, ApplicationContext
Dependency on servlet or Listener in local file, classpath, web application