I'm using spring-data-redis
, spring-session
and Spring Boot to connect to my Redis instance. However I would like spring-data-redis
to connect not to DB 0 (which is default) but to another local database (say DB 1). This is where I'd like the sessions to be stored. Is this possible with spring-data-redis?
The ConnectionFactory
used by RedisTemplate
offers configuration options for setting a default DB. Depending on the Redis driver in use both JedisConnectionFactory
as well as LettuceConnectionFactory
offer void setDatabase(int index)
.
Using Spring Boot RedisProperties
allows to set the default DB via setDatabase
or by providing spring.redis.database
.