Ver código fonte

修正Redis服务器没有设置密码,但客户端向其发送身份验证请求的问题

youken9980 4 anos atrás
pai
commit
ac2115114c

+ 1 - 1
server/src/main/config/application.properties

@@ -33,7 +33,7 @@ office.home = ${KK_OFFICE_HOME:default}
 cache.type =  ${KK_CACHE_TYPE:jdk}
 #redis连接,只有当cache.type = redis时才有用
 spring.redisson.address = ${KK_SPRING_REDISSON_ADDRESS:127.0.0.1:6379}
-spring.redisson.password = ${KK_SPRING_REDISSON_PASSWORD:123456}
+spring.redisson.password = ${KK_SPRING_REDISSON_PASSWORD:}
 #缓存是否自动清理 true 为开启,注释掉或其他值都为关闭
 cache.clean.enabled = ${KK_CACHE_CLEAN_ENABLED:true}
 #缓存自动清理时间,cache.clean.enabled = true时才有用,cron表达式,基于Quartz cron

+ 2 - 1
server/src/main/java/cn/keking/config/RedissonConfig.java

@@ -1,6 +1,7 @@
 package cn.keking.config;
 
 import io.netty.channel.nio.NioEventLoopGroup;
+import org.apache.commons.lang3.StringUtils;
 import org.redisson.client.codec.Codec;
 import org.redisson.config.Config;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
@@ -63,7 +64,7 @@ public class RedissonConfig {
                 .setConnectTimeout(connectTimeout)
                 .setIdleConnectionTimeout(idleConnectionTimeout)
                 .setPingTimeout(pingTimeout)
-                .setPassword(password);
+                .setPassword(StringUtils.trimToNull(password));
         Codec codec=(Codec) ClassUtils.forName(getCodec(), ClassUtils.getDefaultClassLoader()).newInstance();
         config.setCodec(codec);
         config.setThreads(thread);