When you declare a POJO instance or bean in the configuration file, you are actually defining a template for bean creation, not an actual bean instance. The actual bean instance is created when the getBean() method is called. While bean is instantiated by the Spring IoC, the framework decides the scope of the instance.
Following are the different bean instance scopes supported in Spring.
You can set the bean scope using the <bean> element scope attribute. The default scope fro bean is set to Singleton. This means that only one instance of bean can be created in the IoC container and the same instance can be shared across.
The following code snippet shows how to define the bean scope using XML configuration.