From the Spring documentation:
Single Ion (Default) Spring IoC container.
session Scopes HTTP session session . Only valid in the context of a web-aware Spring ApplicationContext.
global session scopes global single session session Typically only valid when used in a Portlet context. Only valid in the context of a web-aware Spring ApplicationContext.
singleton -bin has one instance within the entire IoC container
session -bin has one instance within the HTTP session and dies with it:
Session is also discarded when the HTTP Session is eventually discarded.
globalSession -bath is almost analogous to session — it is used in portlet web applications. When you use globalSbin in a "standard" servlet application, these bins have a session -scope:
If you are a standard HTTP session, it can be used
But there is an implicit difference ...
And in what? How to see her?
To see that a session- bus has different instances in different sessions (in the "standard" spring web application), for example, you can refer to the same controller method that has this bean from 2 browser windows (one in normal mode, another in incognito).
Example from the application at hand:
rpfrservice.BlankServiceImpl@6f7b9a10 (1ое окно - http-сессия 1) rpfrservice.BlankServiceImpl@18d5bfc0 (2ое окно - http-сессия 2)
When repeated requests are used all the same instances (because http-session is still alive).
If the scope of a singleton bean, then the instance is always the same:
rpfrservice.BlankServiceImpl@1fec9d33 (1ое окно - http-сессия 1) rpfrservice.BlankServiceImpl@1fec9d33 (2ое окно - http-сессия 2)