Spring IoC Container 

Dependency injection (DI) is also called as IoC .In this process objects describe their dependencies, and the container injects those dependencies when it creates the bean.

The container is the backbone of the Spring framework. A container is generally bean pool i. e. pool of beans that is build in a memory space by the framework when the application starts. An API provided by the framework disclosed methods to query the container beans.

Spring IOC Container

Spring IOC Container

In Spring, the objects that form the backbone of an application and are managed by the Spring IoC container are beans. A bean is an object which can be instantiated, managed , and assembled by IoC container. Beans, and the dependencies between them, are repeated in the configuration metadata .The metadata is described in the form of XML, Java annotations and in the Java code.

Container Overview
The org.springframework.beans and the org.springframework.context packages both are the base of IoC container. Spring IoC container is defined by the interface an org.springframework.context. ApplicationContext is responsible for bean creation, configuration, and also for assemble .
IOC containers in spring framework are of two types-

1. BeanFactory Container:- It is defined by the org.springframework.beans.factory. BeanFactory interface that add the configuration framework as well as main functionality for DI.

2. Application context Container:-ApplicationContext interface is an extension of Bean Factory and is defined by the org.springframework.context. ApplicationContext interface that adds more enterprise-specific functionality.
Distinguish between BeanFactory and Application context

The BeanFactory interface gives an modern tool of configuration and are capable of managing all type of object. ApplicationContext is the sub-interface of BeanFactory. It adds easy integration with the Spring’s AOP characteristics, message resource handling and an application-layer particular contexts etc.

In summary, the BeanFactory provides the configuration framework and basic functionality, but the ApplicationContext compute more enterprise-specific functionality. The ApplicationContext is a entire superset of the BeanFactory, and is used completely. So ApplicationContext preffered more than BeanFactory.