I am looking to implementing User Session in Spring Boot application using Redis.
I have came across two great dependencies that aims to achieve these goals. Spring Data Redis and Spring Session Data Redis.
However, I have tried looking for differences of these dependencies, but to no avail.
From my understanding, if I am looking at only using Redis for Session Management, then I should use Spring Session Data Redis (even though Spring Data Redis works as well, but not as elegant).
On the other hand, if I am looking at using Redis for Session Management && Caching, then Spring Data Redis is a better option.
2
Answers
In general terms, Spring Session provides support for session management in Spring applications. It supports various different backends for storing session data, one of which is Redis. This Redis support is provided by Spring Session Data Redis.
Spring Session Data Redis builds on top of Spring Data Redis, using it to simplify its code that stores session data in Redis. Given this relationship between the two, this isn’t really a question of choosing one versus the other. Uses Spring Session Data Redis for session management while at the same time using Spring Data Redis to store you application’s own data is a common usage of the two projects.
Yes your understanding is correct. You can find the documentation for spring session data redis here and Spring Data redis here