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

Testing controller

------Controller------------- @RestController @RequestMapping("/items") public class ItemController {     private final ItemServic...