38. Spring Session
Spring Boot provides Spring Session auto-configuration for a wide range of stores:
- JDBC
- MongoDB
- Redis
- Hazelcast
- HashMap
If Spring Session is available, you only need to choose the StoreType
that you wish to use to store the sessions. For instance to use JDBC as backend store, you’d configure your application as follows:
spring.session.store-type=jdbc
Note | |
---|---|
For backward compatibility if Redis is available Spring Session will be automatically configured to use Redis. |
Tip | |
---|---|
You can disable Spring Session by setting the store-type to none . |
Each store has specific additional settings. For instance it is possible to customize the name of the table for the jdbc store:
spring.session.jdbc.table-name=SESSIONS