There are 5 bean scopes in spring framework.
- singleton
- prototype
- session
- request
- globalsession
singleton
The bean instance will be only once and same instance will be returned by the IOC container. It is the default scope.
prototype
The bean instance will be created each time when requested.
session
The bean instance will be created per HTTP session.
request
The bean instance will be created per HTTP request.
globalsession
The bean instance will be created per HTTP global session. It can be used in portlet context only.
No. | Scope | Description |
---|---|---|
1) | singleton | The bean instance will be only once and same instance will be returned by the IOC container. It is the default scope. |
2) | prototype | The bean instance will be created each time when requested. |
3) | request | The bean instance will be created per HTTP request. |
4) | session | The bean instance will be created per HTTP session. |
5) | globalsession | The bean instance will be created per HTTP global session. It can be used in portlet context only. |
please add basics of spring for beginners
LikeLike