1.没有导入redis包,那么导入下面的jar包即可解决
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
2.做了项目分离,那么要注意Application启动类进行@Component扫描的范围,默认扫描Application启动类包及子包下的bean。
比如A项目是redis-common,A项目的包名是com.zhangsan.common.redis。B项目导入A项目的jar包,B项目的包名是com.zhangsan.service.B,那么B项目的Application启动类应该放在com.zhangsan下面,这样才能把A项目中的bean加载到A项目中。
参考若依项目出现的问题