天天看點

Java Spring Boot2.0 連接配接 Redis 出錯:Unsatisfied dependency expressed through field 'redisRepository'

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等是否正确

重新啟動就可以了