[] Spring IoC IoC introduction (a)

  IoC (Inversion of Control) responsibilities: the original initiative by instantiating new objects in this matter, now referred to by the programmer in charge of Spring, that is the responsibility of the IoC container.

  Spring container is the core Spring Framework. The container object is created to connect them together, configure them, and manage their entire lifecycle from creation to destruction. Spring container dependency injection (DI) to manage the components of an application. These objects are known as Spring Beans.

  Configuration instruction by reading metadata provided, the container know which object is instantiated, the configuration and assembly. Configuration metadata can be represented by XML, Java annotations or Java code.

  IOC has a dependency injection container vessel function, it can create an object, IOC container is responsible for instantiating, locate, target and dependencies between these objects configuration application. Typically a new instance, the control by the programmer control, and "control reversal" means new working examples but do not help the programmer to do Spring container. In Spring BeanFactory is the actual representation of IOC container.

  Spring provides two different types of containers:

  • BeanFactory container: it is the simplest container, to DI provides basic support it with org.springframework.beans.factory.BeanFactory interface to define. BeanFactory or related interfaces, such as BeanFactoryAware, InitializingBean, DisposableBean.

  • ApplicationContext container: The container adds more enterprise-specific features such as the ability to parse text information from a properties file, the ability to event listeners application events of interest to publish. The container is defined by the interface org.springframework.context.ApplicationContext.

  BeanFactory ApplicationContext container including a container of all the features.

Guess you like

Origin www.cnblogs.com/myitnews/p/11548221.html