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

I set up a set of projects, using springboot version 2.3.0. When I started, I repeatedly reported errors, so I started a long journey of error finding. At first, I thought it was because the framework was not well configured. Finally, I found that it was the problem of redis.

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

reason

I report an error because I didn’t introduce the jedis dependency. Another reason is that the Maven dependent versions of jedis and spring boot starter data redis are incompatible, which is a common problem. The same is true when the jedisconnectionfactory cannot be created.

solve

Just introduce the jedis dependency to solve the problem

   <!--redis cache-->
   <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-data-redis</artifactId>
   </dependency>
   <!--spring boot2.x The above version needs to be introduced, otherwise the startup will report an error!-->
   <dependency>
       <groupId>redis.clients</groupId>
       <artifactId>jedis</artifactId>
   </dependency>

Launch again

perfect solution~

Read More: