Spring Data Redis: Setting a Password

EvilJinious1 picture EvilJinious1 · Oct 12, 2016 · Viewed 10.6k times · Source

I have a need to provide a secure connection to Redis from my microservices.

So if I want to add the ability to support authentication so that a client can send an AUTH command with a password. See http://redis.io/topics/security

How can I do this with the Spring Data Redis implementation?

Answer

mp911de picture mp911de · Oct 13, 2016

Just set the password on LettuceConnectionFactory or JedisConnectionFactory, depending on which driver you're using. If you use Spring Boot, set spring.redis.password=… in your application configuration (see Common application properties.