Monday, June 21, 2021

What is bean scope?

- Scope refers to the life cycle of a bean .

-How long does the bean will alive

-How the bean will share

-How many instances will created

By default bean scope is singleton.

Singleton: Spring container will create single instance .All request for the bean will return a shared reference for that bean.


Other scopes:

-Prototype:Create new reference and return it .
 


No comments:

Post a Comment

Abstract factory pattern

When single task can be done by multiple groups/family of objects and decision is taken at the runtime.