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

Clean code chapter 3(Robert C.martin)

  Summary: --------  1. Functions should hardly ever be 20 lines long.  2.Keep blocks (inside if, else, while, for, etc.) short.  Ideally, j...