Skip to content

Commit

Permalink
feat: Redis Password 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
f1v3-dev committed Sep 30, 2024
1 parent dd7286c commit d8191b9
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,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;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
Expand All @@ -14,11 +15,18 @@
@Configuration
@EnableRedisRepositories
public class RedisConfig {

private final RedisProperties redisProperties;

@Bean
public RedisConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisProperties.getHost(), redisProperties.getPort());

RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration();
configuration.setHostName(redisProperties.getHost());
configuration.setPort(redisProperties.getPort());
configuration.setPassword(redisProperties.getPassword());

return new LettuceConnectionFactory(configuration);
}

@Bean
Expand Down

0 comments on commit d8191b9

Please sign in to comment.