Home  >  Article  >  Database  >  What should I do if SpringBoot integrates redis and reports errors?

What should I do if SpringBoot integrates redis and reports errors?

王林
王林forward
2023-06-02 17:13:041731browse

Error one

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

Error two

Error creating bean with name 'redisTemplate' defined in class path resource
What should I do if SpringBoot integrates redis and reports errors?

Cause

I got the error because I didn’t introduce the jedis dependency. Another reason is that the versions of the maven dependencies of jedis and spring-boot-starter-data-redis are incompatible, which is a common problem. The same is true if JedisConnectionFactory cannot be created.

Solution

You only need to introduce jedis dependency, to solve it

   <!--redis缓存-->
   <dependency>   <groupId>org.springframework.boot</groupId>   <artifactId>spring-boot-starter-data-redis</artifactId>
   </dependency>
   <!--spring boot2.x以上版本需要引入&#xff0c;不然启动会报错&#xff01;-->
   <dependency>   <groupId>redis.clients</groupId>   <artifactId>jedis</artifactId>
   </dependency>

Start again
What should I do if SpringBoot integrates redis and reports errors?

The above is the detailed content of What should I do if SpringBoot integrates redis and reports errors?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete