|
@@ -21,9 +21,9 @@ import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import redis.clients.jedis.JedisPool;
|
|
|
-import redis.clients.jedis.JedisPoolAbstract;
|
|
|
import redis.clients.jedis.JedisPoolConfig;
|
|
|
import redis.clients.jedis.JedisSentinelPool;
|
|
|
+import redis.clients.jedis.util.Pool;
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
@@ -80,7 +80,7 @@ public class WxQidianStorageAutoConfiguration {
|
|
|
}
|
|
|
|
|
|
private WxQidianConfigStorage jedisConfigStorage() {
|
|
|
- JedisPoolAbstract jedisPool;
|
|
|
+ Pool jedisPool;
|
|
|
if (StringUtils.isNotEmpty(redisHost) || StringUtils.isNotEmpty(redisHost2)) {
|
|
|
jedisPool = getJedisPool();
|
|
|
} else {
|
|
@@ -136,7 +136,7 @@ public class WxQidianStorageAutoConfiguration {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private JedisPoolAbstract getJedisPool() {
|
|
|
+ private Pool getJedisPool() {
|
|
|
WxQidianProperties.ConfigStorage storage = wxQidianProperties.getConfigStorage();
|
|
|
RedisProperties redis = storage.getRedis();
|
|
|
|
|
@@ -156,8 +156,9 @@ public class WxQidianStorageAutoConfiguration {
|
|
|
config.setTestOnBorrow(true);
|
|
|
config.setTestWhileIdle(true);
|
|
|
if (StringUtils.isNotEmpty(redis.getSentinelIps())) {
|
|
|
+
|
|
|
Set<String> sentinels = Sets.newHashSet(redis.getSentinelIps().split(","));
|
|
|
- return new JedisSentinelPool(redis.getSentinelName(), sentinels);
|
|
|
+ return new JedisSentinelPool(redis.getSentinelName(), sentinels,config);
|
|
|
}
|
|
|
|
|
|
return new JedisPool(config, redis.getHost(), redis.getPort(), redis.getTimeout(), redis.getPassword(),
|