Skip to content

Commit

Permalink
fix: Redisson Password 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
f1v3-dev committed Oct 18, 2024
1 parent 8346a4f commit b62dec8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 33 deletions.
20 changes: 20 additions & 0 deletions src/main/java/com/dnd/jjakkak/global/config/redis/RedisConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.dnd.jjakkak.global.config.redis;

import lombok.RequiredArgsConstructor;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -23,6 +26,8 @@
public class RedisConfig {

private final RedisProperties redisProperties;
private static final String REDISSON_HOST_PREFIX = "redis://";


@Bean
public RedisConnectionFactory redisConnectionFactory() {
Expand All @@ -43,4 +48,19 @@ public RedisTemplate<String, Object> redisTemplate() {
template.setConnectionFactory(redisConnectionFactory());
return template;
}


/**
* Redisson Client 등록 메서드.
*/
@Bean
public RedissonClient redissonClient() {
Config config = new Config();
config.useSingleServer()
.setAddress(REDISSON_HOST_PREFIX + redisProperties.getHost() + ":" + redisProperties.getPort())
.setPassword(redisProperties.getPassword())
.setSslEnableEndpointIdentification(true);

return Redisson.create(config);
}
}

This file was deleted.

0 comments on commit b62dec8

Please sign in to comment.