From b010212d2c940af309b610cd2a111412f2311ecf Mon Sep 17 00:00:00 2001 From: zhuon Date: Fri, 10 May 2019 10:22:27 +0800 Subject: [PATCH] redis password null --- src/main/java/com/wang/config/redis/JedisConfig.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/wang/config/redis/JedisConfig.java b/src/main/java/com/wang/config/redis/JedisConfig.java index 1359f16..c45f583 100644 --- a/src/main/java/com/wang/config/redis/JedisConfig.java +++ b/src/main/java/com/wang/config/redis/JedisConfig.java @@ -1,5 +1,6 @@ package com.wang.config.redis; +import com.wang.util.common.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -57,7 +58,8 @@ public JedisPool redisPoolFactory() { jedisPoolConfig.setMaxTotal(maxActive); jedisPoolConfig.setMinIdle(minIdle); // JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, password); - JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, null); + String pwd = StringUtil.isBlank(password) ? null : password; + JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, pwd); LOGGER.info("初始化Redis连接池JedisPool成功!地址: " + host + ":" + port); return jedisPool; } catch (Exception e) {