SpringBoot整合redis报错怎么办

错误一

org.springframework.data.redis.connection.RedisConnectionFactory’ that could not be found

错误二

Error creating bean with name ‘redisTemplate’ defined in class path resource

原因

我是因为没有引入jedis依赖造成的报错。还有原因是由于jedis 和spring-boot-starter-data-redis 的maven依赖的版本不兼容导致, 是经常会出现的问题。出现JedisConnectionFactory 无法创建也是一样。

解决

只需要引入jedis依赖,即可解决

   
      org.springframework.boot   spring-boot-starter-data-redis
   
   
      redis.clients   jedis
   

再次启动