Prechádzať zdrojové kódy

添加redis密码配置

wujiefeng 8 mesiacov pred
rodič
commit
ddcf3e2410

+ 5 - 1
RewardServer/src/main/java/com/zhongshu/reward/server/core/util/ext/RedisExtProperties.java

@@ -1,6 +1,8 @@
 package com.zhongshu.reward.server.core.util.ext;
 
 import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -13,6 +15,7 @@ import redis.clients.jedis.JedisPoolConfig;
  */
 @Data
 @Configuration
+@Slf4j
 public class RedisExtProperties {
 
     @Value("${spring.redis.host}")
@@ -46,7 +49,8 @@ public class RedisExtProperties {
         jedisPoolConfig.setMaxIdle(maxIdle);
         jedisPoolConfig.setMaxTotal(maxActive);
         jedisPoolConfig.setJmxEnabled(false);
-        return new JedisPool(jedisPoolConfig, host, port, timeout, null, database);
+        log.info("password is:{},is empty:{},len:{}",password, StringUtils.isEmpty(password),password.length());
+        return new JedisPool(jedisPoolConfig, host, port, timeout, StringUtils.isEmpty(password)? null:password, database);
     }