redis java连接出错_redis连接错误与spring boot

我使用spring boot框架来连接redis,我得到了错误

Caused by: java.lang.NoSuchMethodError: redis.clients.jedis.JedisShardInfo.(Ljava/lang/String;IZLjavax/net/ssl/SSLSocketFactory;Ljavax/net/ssl/SSLParameters;Ljavax/net/ssl/HostnameVerifier;)V

at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.afterPropertiesSet(JedisConnectionFactory.java:332)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1761)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1698)

... 90 more

here is my redis configure code

@Configuration

public class RedisConfig {

@Bean

JedisConnectionFactory jedisConnectionFactory() {

return new JedisConnectionFactory();

}

@Bean

public RedisTemplate redisTemplate() {

RedisTemplate template = new RedisTemplate();

Jackson2JsonRedisSerializer redisSerializer = new Jackson2JsonRedisSerializer(Object.class);

template.setConnectionFactory(jedisConnectionFactory());

template.setKeySerializer(redisSerializer);

template.setValueSerializer(redisSerializer);

return template;

}

@Bean

ChannelTopic topic() {

return new ChannelTopic("messageQueue");

}

}

我已经多次阅读该文档,但我仍然无法找到解决方案


版权声明:本文为weixin_31179927原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。