找不到 redis.clients.jedis.JedisShardInfo 的 class 文件

class file for redis.clients.jedis.JedisShardInfo not found

当我在 gradle.build 中将 jedis 升级到 4.2.3 版本时:

    api "redis.clients:jedis:4.2.3"

显示错误:

/Users/xiaoqiangjiang/source/reddwarf/backend/retire/dolphin-common/src/main/java/misc/config/redis/RedisConfig.java:77: error: cannot access JedisShardInfo
        return new JedisConnectionFactory(redisConfig);
               ^
  class file for redis.clients.jedis.JedisShardInfo not found

这是 redis 配置:

    @Bean
    public JedisConnectionFactory redisConnectionFactory() {
        var redisConfig = new RedisStandaloneConfiguration(redisHost, redisPort);
        redisConfig.setPassword(redisPwd);
        return new JedisConnectionFactory(redisConfig);
    }

为什么会出现这个错误?我该怎么做才能解决它?我从 google 搜索过似乎没有人遇到这个问题。

class JedisShardInfo 自 Jedis 4 后被删除。

The ShardedJedisPool, Sharded, ShardedJedis, BinaryShardedJedis, ShardInfo, JedisShardInfo classes have been removed.

这里是the list of all breaking changes between Jedis 3.x and Jedis 4.x