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

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

王林
Release: 2023-06-02 17:13:04
forward
1803 people have browsed it

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>
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template