🎨 兼容SpringBoot3中使用的Jedis4版本

This commit is contained in:
Vycz 2023-06-04 23:01:19 +08:00 committed by GitHub
parent 17ba4bbc86
commit a7c793ecf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,16 +14,16 @@ import me.chanjar.weixin.mp.config.WxMpConfigStorage;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl; import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolAbstract;
import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisSentinelPool; import redis.clients.jedis.JedisSentinelPool;
import redis.clients.jedis.util.Pool;
import java.util.Set; import java.util.Set;
@ -74,7 +74,7 @@ public class WxMpStorageAutoConfiguration {
} }
private WxMpConfigStorage jedisConfigStorage() { private WxMpConfigStorage jedisConfigStorage() {
JedisPoolAbstract jedisPool; Pool<Jedis> jedisPool;
if (wxMpProperties.getConfigStorage() != null && wxMpProperties.getConfigStorage().getRedis() != null if (wxMpProperties.getConfigStorage() != null && wxMpProperties.getConfigStorage().getRedis() != null
&& StringUtils.isNotEmpty(wxMpProperties.getConfigStorage().getRedis().getHost())) { && StringUtils.isNotEmpty(wxMpProperties.getConfigStorage().getRedis().getHost())) {
jedisPool = getJedisPool(); jedisPool = getJedisPool();
@ -131,7 +131,7 @@ public class WxMpStorageAutoConfiguration {
} }
} }
private JedisPoolAbstract getJedisPool() { private Pool<Jedis> getJedisPool() {
RedisProperties redis = wxMpProperties.getConfigStorage().getRedis(); RedisProperties redis = wxMpProperties.getConfigStorage().getRedis();
JedisPoolConfig config = new JedisPoolConfig(); JedisPoolConfig config = new JedisPoolConfig();