From 4886e90c07560f44fa38fd13fb7ff56304f47982 Mon Sep 17 00:00:00 2001 From: DongHoon Lee Date: Tue, 24 Dec 2024 17:22:56 +0900 Subject: [PATCH] =?UTF-8?q?[#291]=20refactor(RedisConfig):=20password=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - main에 머지 전 prod 레디스에 비밀번호 설정 필요함. --- .../java/com/beat/global/common/config/RedisConfig.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/beat/global/common/config/RedisConfig.java b/src/main/java/com/beat/global/common/config/RedisConfig.java index 636efa46..e2bc48b5 100644 --- a/src/main/java/com/beat/global/common/config/RedisConfig.java +++ b/src/main/java/com/beat/global/common/config/RedisConfig.java @@ -4,6 +4,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; 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; @@ -16,9 +17,14 @@ public class RedisConfig { @Value("${spring.data.redis.port}") private int port; + @Value("${spring.data.redis.password}") + private String password; + @Bean public RedisConnectionFactory redisConnectionFactory() { - return new LettuceConnectionFactory(host, port); + RedisStandaloneConfiguration redisConfiguration = new RedisStandaloneConfiguration(host, port); + redisConfiguration.setPassword(password); + return new LettuceConnectionFactory(redisConfiguration); } @Bean