我正在使用jedis客户端连接到Spring启动应用程序中的Redis集群 . 我正在尝试为DynoJedisclient注册bean . spring boot的版本是1.5.8.RELEASE和jedis的版本是2.9.0以下是代码片段
@Bean(name="dynoClient")
public DynoJedisClient client() {
try {
if (CacheManager.consulBaseURL != null) {
DynoJedisClient client = new DynomiteClient.Builder()
.withConsulConfiguration(CacheManager.consulBaseURL,
CacheManager.consulPrefix,
CacheManager.dynoConfigFileName).build()
.getRedisClient();
log.debug("Remote Redis cache initialized successfully.");
return client;
}else{
return null;
}
} catch (IOException | DynoConnectException | DynomiteClientException e) {
throw new RedisException(
RedisErrorCode.REDIS_CONFIGURATION_EXCEPTION, e);
} catch (Exception ex) {
throw new RedisException(
RedisErrorCode.REDIS_CONFIGURATION_EXCEPTION, ex);
}
}
我在 Spring 季启动应用程序的引导时遇到异常
引起:org.springframework.beans.factory.BeanCreationException:在类路径资源[com / test / config / RedisConfiguration.class]中定义名为'dynoClient'的bean时出错:合并bean定义的后处理失败;嵌套异常是java.lang.NoClassDefFoundError:redis / clients / jedis / commands / RedisPipeline