nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 报错

在搭建启动springboot项目的时候,遇到一个错误:完整异常信息如下

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.****service.UserService ; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisDAO': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'JedisClusterFactory' defined in com.roncoo.eshop.inventory.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.clients.jedis.JedisCluster]: Factory method 'JedisClusterFactory' threw exception; nested exception is java.lang.NumberFormatException: For input string: "7004@17004"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)

 

异常信息截图:

 

nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 报错_第1张图片

遇到这个错误的时候,百度了一下,说是jedis cluster客户端的版本不够,那么我们先看一下服务端的版本,登录redis-cli -c -h xxx -p xxx,登录client上去,然后输入info,版本为4.0.6

nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 报错_第2张图片

查看pom文件里面的jedis版本,

nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 报错_第3张图片

居然没指定版本,我们换一下:

nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 报错_第4张图片

再次启动项目,ok启动成功:

nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 报错_第5张图片

你可能感兴趣的:(Redis,redis)