springboot自定义RedisConfig配置类报错Could not autowire. No beans of ‘RedisConnectionFactory‘ type found.

具体报错:Could not autowire. No beans of ‘RedisConnectionFactory’ type found. 如下图:
springboot自定义RedisConfig配置类报错Could not autowire. No beans of ‘RedisConnectionFactory‘ type found._第1张图片
报错原因:
一、未导入pom依赖:

    <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>4.2.3</version>
   </dependency>

二、未加注解:@SuppressWarnings(“all”)如下图:
springboot自定义RedisConfig配置类报错Could not autowire. No beans of ‘RedisConnectionFactory‘ type found._第2张图片

最后问题成功解决!!!

你可能感兴趣的:(spring,boot,java,redis)