Sunday, September 12, 2021

Bean scope-

 By default bean scope is singleton that means every time we get a bean from ioc container will give me the copy of a bean .so beans are the same object.

But if we want to get different beans every time from the ioc container we should use prototype . 

To define a prototype bean we can use @Scope("prototype")/@ConfigurableBeanFactory.SCOP_PROTOTYPE

ex:


No comments:

Post a Comment

Fluent interface pattern

 public class UserConfigurationManager {     private String userName;     private String password;     private UserConfigurationManager() { ...