IOC stands for the Inversion of Container. It is a container used in Spring core Framework. It is responsible for managing the states of the object i.e from its creation till its destruction. Before Spring framework, developer/programmer were responsible for creating and destroying the object, but with the development of Core Spring it is taken care by its Container itself i.e IOC container, but programmer needs to write some configuration in the XML file to indicate Container when and how to create an instance of the bean. In Spring a general java class i.e POJO ( Plain Old Java Object ) are considered as Bean. And its instance is called as Bean Object.    


When to create a Bean object is defined by mapping bean in the XML. As it mapped in the XML, in that way Container tries to create its Object. 

How to create a Bean Object is defined by Dependencies Injection.So Injection can be done in two ways only , either by Constructor or by Getter method. In general ways injection is defined as the way of creating an Bean class Object.     


Responsibility of IOC

Three main responsibility of the IOC is
1. Loading the bean classes .
1. Creating an instance for the bean using Dependencies Injection
3. Injecting the bean dependencies.

Spring Container reads the Configuration metadata where we configured our bean classes with its Dependency Injection. Together using POJO classes and its configuration in the XML file , Container try to load the bean classes and Inject the bean dependencies. 

In Spring There are two types of IOC container ,
1. BeanFactory Container.
2. ApplicationContext Container. ( Supports Annotation )

ApplicationContext was developed after BeanFactory with some extending functionality and over comes all the limitations which was with the BeanFactory and introduced some new features like supporting Annotation etc.

Note : A Container is simply a java object which manages the different states of an object and manages the life cycle of bean.


Related Posts:

  • Alternatives of Open Session In View(OSIV) Today I am going to tell you other alternative you can do in order to avoid LazyInitializationException: Session has been closed. If you are using SPRING with HIBERNATE that you can take the advantages of IOC and AOP. These … Read More
  • Dependencies Injection of Bean Dependencies means how a java bean is dependent on another bean class. That means if we defines any bean reference as a class member to another bean class, then it results in a bean dependent on another. A primitive type or… Read More
  • IoC Container In Spring IOC stands for the Inversion of Container. It is a container used in Spring core Framework. It is responsible for managing the states of the object i.e from its creation till its destruction. Before Spring framework, develo… Read More
  • Spring Implicit Wiring : byType In this type of auto-wiring container detect the bean instance with its data type and checks the data type of the bean instance running in the container with the bean type mentioned in the dependency bean. Some of the task … Read More
  • Benefit of using Spring Framework Provide a good programming practice by decoupling the layers. If you are using spring in your project it decouples the layers and hence it's easy to write the test case for them. So it's easy from maintenance point of view.… Read More

1 comment:

Ads 468x60px

.

Ads

.

Featured Posts

Popular Posts

Like Us On FaceBook

Total Pageviews

201976

Online Members

Live Traffic