Spring Fundamentals – A quick walkthrough



Spring behaves as a factory of beans, in other words it act as a bean container. Sp pretty much any POJOs we are creating can be contained in the Spring Container. Inside this container, there can be number of objects contained. The container deals with this objects and take care about object instantiate, manage object life cycle and the destruction of the objects.

To manage the object life cycle inside the Spring container, the container should handle the objects. It is done via the creation of the objects which is done through the container.


Imagine a scenario where we need to create objects out of the spring container. This can be done using “New” keyword outside the container. But the Spring approach is much different. The container will create the objects inside it and pass to the outer objects. It is more like factory pattern. The container acts as a factory and uses some configuration files to do the task.


Just like this factory pattern the Spring Bean Factory do the object creation.


The XML file has the bean configuration. According to that configuration, Spring Container  create new Spring Beans and hands over them to the outer object. So the object life cycle is totally handled by the Spring Bean Container. 


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s