springboot集成redis时,在pom文件中引入spring-boot-starter-redis包报错,提示找不到相应的jar包,如下图:

在本地maven仓库中找了一遍,确实没有这个jar包,以为是没有从中央仓库下载下来,所以重新运行maven命令下载jar包并更新项目,依然报错。
网上搜下了问题,才知道,原来我项目用的spring boot是2.0以后的版本,spring-boot-starter-redis在springboot 1.4.7版本后,
改为了spring-boot-starter-data-redis,所以如果想集成redis,应该引用spring-boot-starter-data-redis。
如果就是想用前者,那么就应该加上版本号。

本文解析了在SpringBoot项目中集成Redis时遇到的常见错误,即使用spring-boot-starter-redis包导致的找不到jar包问题。介绍了spring-boot-starter-redis在SpringBoot 1.4.7版本后更名的背景,以及正确的依赖引入方式。

457

被折叠的 条评论
为什么被折叠?



