O'Reilly logo

Spring: Developing Java Applications for the Enterprise by Ravi Kant Soni, Rajesh RV, Amuthan Ganeshan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The bean's scope

Spring provides us with beans after instantiating and configuring them. Spring Container manages objects. This means that any object can refer to any other object from Spring Container using the bean's ID, and Spring Container provides an instance of the requesting object.

When we start Spring Container, ApplicationContext reads the Spring configuration, file looks for all bean definitions available there, and then initializes beans before any call to the getBean() method.

During initialization, ApplicationContext itself has initialized all the Spring beans configured in Spring XML. When another object makes a call to the getBean() method, ApplicationContext returns the same reference of bean that has already been initialized. This ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required