Articles

Spring ioc container internal working explained with diagram

Spring ioc container internal working explained with diagram


To learn about spring IOC container in details click here.

 

Here we will simply answer - how spring container works internally?

 

We know that spring container or IOC container is at the core of spring framework.

 

The Spring Container is responsible to:

  • create the objects (bean)
  • wire the created objects together
  • configure the objects
  • manage the objects complete life cycle from creation till destruction.

But lets understand how all these tasks are performed internally by spring IOC container.

 

Spring IOC container accepts two components as input :

  1.  Java POJO (Learn about pojo)
  2. Configuration metadata in form of xml file, java based configurations, annotation or mixture of any of the three techniques.

See the image shown below to get better understandability of spring container working:

spring ioc container internal working

The configuration metadata contains instruction for container about:

  • Which bean objects to create?
  • How to configure the beans?
  • What is the scope for each beans?
  • How to configure the created beans?

So we can see that spring container performs responsible tasks mentioned at the beginning by reading the instructions in configuration metadata.

 

In Spring, objects do not have responsibility of finding or creating their dependency that need to complete their task. Rather the Spring container takes the responsibility of giving the reference to the objects with whom they need to collaborate with.

 

This is how spring container works internally to create a working spring application. To learn complete spring framework visit our spring tutorial.


Spring Interview Questions

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Sonu Pandit
Technology geek, loves to write and share knowledge with the world. Having 10+ years of IT experience. B.Tech in Computer Science & Engineering
Page Views :    Published Date : Jul 15,2020  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!