adspace


What is difference between singleton and prototype bean?

Answer Posted / Pratigya Chaudhary

A Singleton Bean in Spring Framework is created only once per Spring container, while a Prototype Bean is created every time it is requested. This makes Singletons suitable for objects that are expensive to create but don't change during the application lifecycle, whereas Prototypes are suitable for objects that can be modified or recreated as needed.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you inject java collection in spring?

518


What is difference between @controller and @restcontroller in spring?

556


What is lazy class?

490