diff --git a/genti-auth/src/main/java/com/gt/genti/config/RedisConfig.java b/genti-auth/src/main/java/com/gt/genti/config/RedisConfig.java index 604a8f99..85a0232e 100644 --- a/genti-auth/src/main/java/com/gt/genti/config/RedisConfig.java +++ b/genti-auth/src/main/java/com/gt/genti/config/RedisConfig.java @@ -5,6 +5,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.RedisStandaloneConfiguration; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; @@ -24,9 +25,16 @@ public class RedisConfig { @Value("${redis.port}") private int port; + @Value("${redis.password}") + private String password; + @Bean public RedisConnectionFactory redisConnectionFactory() { - return new LettuceConnectionFactory(host, port); + RedisStandaloneConfiguration redisConfiguration = new RedisStandaloneConfiguration(); + redisConfiguration.setHostName(host); + redisConfiguration.setPort(port); + redisConfiguration.setPassword(password); + return new LettuceConnectionFactory(redisConfiguration); } @Bean