Spring Bean Scopes
Spring Bean Scope In the spring bean configurations, bean attribute called 'scope' defines what kind of object has to created and returned. There are 5 types of bean scopes available, they are: 1) singleton: Returns a single bean instance per Spring IoC container. 2) prototype: Returns a new bean instance each time when requested. 3) request: Returns a single instance for every HTTP request call. 4) session: Returns a single instance for every HTTP session. 5) global session: global session scope is equal as session scope on portlet-based web applications. If no bean scope is specified in bean configuration file, then it will be by default 'singleton'. The scope of a bean defines the life cycle and visibility of that bean in the contexts in which it is used. Spring defines 5 types of scopes: singleton prototype request session globalSession When defining a <bean> in Spring, you have the option of declaring a s...