Tag Archives: Error creating bean with name XXX

When integrating redis with SSM framework, error creating bean with name ‘rediscontentserviceimpl’ defined in file

When integrating redis in SSM framework, error creating bean with name ‘rediscontentserviceimpl’ defined in file

Error report: there is a problem with bean dependency, that is, there is a problem with bean injection. Finally, we found that there was a problem with the version of the connection between redis and jedis. We found a new version and solved it.

        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.7.3</version>
        </dependency>
        <!-- spring-redis-->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-redis</artifactId>
            <version>1.6.2.RELEASE</version>
        </dependency>

 

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~