I have a simple redis server running with a password. I want to talk with it from my spring boot app. I look here and see there is a spring.redis.password
so my application-local.yml (running with -Dspring.profiles.active=local
) looks like...
spring:
redis:
password: ...
but when I run I get
NOAUTH Authentication required
What am I missing? I can connect via node.js like...
import redis from "redis";
const client = redis.createClient({
password: "..."
});
Additional Code
@Bean
LettuceConnectionFactory redisConnectionFactory(){
RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
return new LettuceConnectionFactory(config);
}
@Bean
public RedisTemplate<String, Object> redisTemplate(){
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(redisConnectionFactory());
return template;
}
also tried...
@Bean
LettuceConnectionFactory redisConnectionFactory(){
RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
if (redisPassword != null){
config.setPassword(redisPassword);
}
return new LettuceConnectionFactory(config);
}
and this works but seems overly verbose given it is a standard property.