What are Spring Beans?

Spring beans are just object instances that instantiated, assembled, and otherwise managed by a Spring IoC container. They are created and wired by the framework and put into a "bag of objects" i.e. Spring Container from where you can get them later.

When you create a bean definition(XML configurations or annotations) what you are actually creating is a recipe for creating actual instances of the class defined by that bean definition. The idea that a bean definition is a recipe is important, because it means that, just like a class, you can potentially have many object instances created from a single recipe.

Below image shows life cycle of a Spring bean managed by spring container.

 

spring 12

FOLLOW US ON LinkedIn



Explore Tutu'rself