spring bean scopes examples
Spring bean scopes:
As we discussed that spring container is responsible for creating and managing bean object. Spring provides the facility to return the same instance or a new instance each time when one is needed. It depends upon the bean scope.
Spring framework bean scopes:
||It scopes the bean definition to a single instance per spring container. It is the default scope. Spring container keeps it into cache and returns the same instance each time a request for that particular bean is made.
||It scopes a single bean definition to have new bean instance each time a request for that particular bean is made.
||It scopes a bean definition to an HTTP request.
||It scopes a bean definition to an HTTP session.
||It scopes a bean definition to a global HTTP session.
Note: The request, session and global-session are only available in the context of a web-aware ApplicationContext.