Looking at the Spring Boot docs I only found examples to use session with Redis, Is it possible to use it without Redis?
HTTPSession is stored in the database and not in the server disk/ memory. Spring sessions a transparent replacement in Spring Boot. We don't need any code change (few configurations) and adding spring session as dependency in our project. Spring session make it easy to work in clustered applications.
Spring Session Data Redis - provides SessionRepository and ReactiveSessionRepository implementation backed by Redis and configuration support. Spring Session JDBC - provides SessionRepository implementation backed by a relational database and configuration support.
As said in another answer: Yes, you can change the Session persistence backend by changing the SessionRepository
implementation.
And, there is an built-in alternatives provided by Spring-Session, which is MapSessionRepository
for which you can save session in a Map
.
In the samples of Spring Session, there is a sample using Hazelcast as persistence backend. It is utilizing the above-mentioned MapSessionRepository
with the Map
instance created by Hazelcast.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With