Spring Session Example
Spring Session provides an API and implementations for managing a user’s session information.
Spring Session Features
Spring Session makes it trivial to support clustered sessions without being tied to an application container specific solution. It also provides transparent integration with:
- HttpSession – allows replacing the HttpSession in an application container (i.e. Tomcat) neutral way, with support for providing session IDs in headers to work with RESTful APIs
- WebSession – allows replacing the Spring WebFlux’s WebSession in an application container neutral way
- WebSocket – provides the ability to keep the HttpSession alive when receiving WebSocket messages
Spring Session Modules
Spring Session consists of the following modules:
- Spring Session Core – provides core Spring Session functionalities and APIs
- Spring Session JDBC – provides SessionRepository implementation backed by a relational database and configuration support
- Spring Session Data Redis – provides SessionRepository and ReactiveSessionRepository implementation backed by Redis and configuration support
- Spring Session Hazelcast – provides SessionRepository implementation backed by Hazelcast and configuration support
How to create a spring Session project
If you want to create your own Spring Boot-based and spring security project, visit Spring Initializr, fill in your project details, pick your options, and you can download either a Maven build file, or a bundled up project as a zip file.