提交 cffeaee5 编写于 作者: Z zhuon

redis databse 值 在api/redis接口中没生效

上级 83fe8fab
...@@ -53,6 +53,9 @@ public class RedisConfig extends CachingConfigurerSupport { ...@@ -53,6 +53,9 @@ public class RedisConfig extends CachingConfigurerSupport {
@Value("${spring.redis.password}") @Value("${spring.redis.password}")
private String password; private String password;
@Value("${spring.redis.database}")
private int database;
/** /**
* 配置 redis 连接池 * 配置 redis 连接池
* @return * @return
...@@ -62,11 +65,8 @@ public class RedisConfig extends CachingConfigurerSupport { ...@@ -62,11 +65,8 @@ public class RedisConfig extends CachingConfigurerSupport {
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
jedisPoolConfig.setMaxIdle(maxIdle); jedisPoolConfig.setMaxIdle(maxIdle);
jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);
if (StringUtils.isNotBlank(password)) { String pwd = StringUtils.isBlank(password) ? null : password;
return new JedisPool(jedisPoolConfig, host, port, timeout, password); return new JedisPool(jedisPoolConfig, host, port, timeout, pwd, database);
} else {
return new JedisPool(jedisPoolConfig, host, port,timeout);
}
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册