Java Spring Boot2.0 连接 Redis 出错:Unsatisfied dependency expressed th...

本文解析了在SpringBoot项目中整合Redis时遇到的UnsatisfiedDependencyException异常,详细介绍了错误原因,包括Redis服务器未启动、配置参数错误等问题,并提供了检查及解决步骤。

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisController': Unsatisfied dependency expressed through field 'redisRepository'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisRepositoryImpl' defined in file [F:JavaWorkSpaceAlibaba2018AlibabaJavaSpringBoot2x10RedisDemotargetclassescomfrankxuleirepositoryRedisRepositoryImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTemplate' defined in class path resource [com/frankxulei/config/RedisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.core.RedisTemplate]: Factory method 'redisTemplate' threw exception; nested exception is 。。。
解决办法:
1、检查一下Redis服务器是否启动
2、检查一下Spring Boot的Redis配置参数Host、Port
3、Password等是否正确
重新启动就可以了

[2025-09-30 16:41:54,757][main][org.springframework.boot.web.embedded.tomcat.TomcatStarter(类):62(行)] Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'containerRunListener': Unsatisfied dependency expressed through field 'nettyServerRunner'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nettyServerRunner': Unsatisfied dependency expressed through field 'controlServerBootstrap'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nettyServerConfiguration': Unsatisfied dependency expressed through field 'controlChannelHandler'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'controlChannelHandler': Unsatisfied dependency expressed through field 'controlHandlerService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'controlHandlerServiceImpl': Unsatisfied dependency expressed through field 'deviceCallBackClient'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deviceCallBackClient': Unsatisfied dependency expressed through field 'consumerThread'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'consumerThread': Unsatisfied dependency expressed through field 'cloudPrintService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cloudPrintServiceImpl': Unsatisfied dependency expressed through field 'dasyunUserInfoController'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dasyunUserInfoController': Unsatisfied dependency expressed through field 'firmwareController'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'firmwareController': Unsatisfied dependency expressed through field 'firmwareService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'firmwareServiceImpl': Unsatisfied dependency expressed through field 'redisKeyExpirationListener'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisKeyExpirationListener' defined in URL [jar:file:/usr/local/dasService/app/dasApp.jar!/BOOT-INF/classes!/com/dascom/krdcz/service/RedisKeyExpirationListener.class]: Invocation of init method failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
10-01
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.zalando.problem.spring.web.advice.security.SecurityProblemSupport': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'handlerExceptionResolver' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Failed to instantiate [org.springframework.web.servlet.HandlerExceptionResolver]: Factory method 'handlerExceptionResolver' threw exception with message: Error creating bean with name 'com.longshare.log.collection.interceptor.WebLogHandler': Unsatisfied dependency expressed through field 'parameterCache': Error creating bean with name 'parameterCacheImpl': Unsatisfied dependency expressed through field 'parameterRepository': Error creating bean with name 'parameterRepository': Unsatisfied dependency expressed through field 'parameterService': Error creating bean with name 'com.longshare.microservice.system.support.service.impl.ParameterServiceImpl': Unsatisfied dependency expressed through field 'redissonClient': Error creating bean with name 'redisson' defined in class path resource [org/redisson/spring/starter/RedissonAutoConfigurationV2.class]: Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'redisson' threw exception with message: java.util.concurrent.ExecutionException: org.redisson.client.RedisConnectionException: Unable to connect to Redis server: 168.64.5.128/168.64.5.128:6379 什么意思
最新发布
11-13
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'routerFunctionConfiguration': Unsatisfied dependency expressed through field 'validateCodeHandler'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'validateCodeHandler': Unsatisfied dependency expressed through field 'validateCodeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'validateCodeServiceImpl': Unsatisfied dependency expressed through field 'redisService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisService': Unsatisfied dependency expressed through field 'redisTemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisTemplate' defined in class path resource [com/weichang/gateway/redis/configure/RedisConfig.class]: Unsatisfied dependency expressed through method 'redisTemplate' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConnectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.class]: Unsatisfied dependency expressed through method 'redisConnectionFactory' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lettuceClientResources' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.lettuce.core.resource.DefaultClientResources]: Factory method 'le
05-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值