Singleton scope:
==============================
-> If scope is set to singleton, the Spring IOC container creates exactly one instance of the
object defined by that bean definition. The single instance is stored in a cache of such
singleton beans, and all subsequent requests and references for that named bean return
the cached object.
Prototype scope:
=============================
-> If scope is set to prototype, the Spring IOC container creates new bean instance of the
object every time a request for that specific bean is made.
Use of prototype scope is: Where requirement is state-full beans are there.
Use of singleton scope is: Where requirement is state-less beans are there.
-> If no scope is specified with bean definition, Singleton is the default scope.
==============================
-> If scope is set to singleton, the Spring IOC container creates exactly one instance of the
object defined by that bean definition. The single instance is stored in a cache of such
singleton beans, and all subsequent requests and references for that named bean return
the cached object.
Prototype scope:
=============================
-> If scope is set to prototype, the Spring IOC container creates new bean instance of the
object every time a request for that specific bean is made.
Use of prototype scope is: Where requirement is state-full beans are there.
Use of singleton scope is: Where requirement is state-less beans are there.
-> If no scope is specified with bean definition, Singleton is the default scope.
Comments
Post a Comment