File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/main/java/com/chungang/capstone/openstep/global/config Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ public class RedisConfig {
2222 @ Value ("${spring.data.redis.port}" )
2323 private int port ;
2424
25+ @ Value ("${spring.data.redis.username:}" )
26+ private String username ;
27+
2528 @ Value ("${spring.data.redis.password}" )
2629 private String password ;
2730
@@ -32,7 +35,11 @@ public class RedisConfig {
3235 public LettuceConnectionFactory redisConnectionFactory () {
3336 RedisStandaloneConfiguration config = new RedisStandaloneConfiguration (host , port );
3437
35- if (!password .isBlank ()) {
38+ if (username != null && !username .isBlank ()) {
39+ config .setUsername (username );
40+ }
41+
42+ if (password != null && !password .isBlank ()) {
3643 config .setPassword (RedisPassword .of (password ));
3744 }
3845
@@ -42,7 +49,8 @@ public LettuceConnectionFactory redisConnectionFactory() {
4249 builder .useSsl ();
4350 }
4451
45- return new LettuceConnectionFactory (config , builder .build ());
52+ LettuceClientConfiguration clientConfig = builder .build ();
53+ return new LettuceConnectionFactory (config , clientConfig );
4654 }
4755
4856
You can’t perform that action at this time.
0 commit comments