引入thymeleaf-extras-springsecurity5依赖报错,求排查方案
解决thymeleaf-extras-springsecurity依赖找不到的问题
你的问题核心在于依赖版本与Spring Boot版本不兼容,同时存在依赖artifactId错误:
- 你使用的Spring Boot 3.0.0配套Spring Security 6.x,但你引入的
thymeleaf-extras-springsecurity5是适配Spring Security 5.x的版本,两者不匹配。 - 报错中显示找不到
org.thymeleaf.extras:thymeleaf-extras-springsecurity:pom:unknown,是因为Maven仓库不存在这个无版本后缀的artifactId,适配Spring Boot 3的正确artifactId是thymeleaf-extras-springsecurity6。
修复步骤:
- 修改pom.xml中的对应依赖,替换artifactId:
<dependency> <groupId>org.thymeleaf.extras</groupId> <artifactId>thymeleaf-extras-springsecurity6</artifactId> </dependency>
- 刷新Maven依赖:在IDEA右侧Maven面板点击刷新按钮,或者执行命令:
mvn clean install -U
完成后依赖即可正常加载。
内容的提问来源于stack exchange,提问作者tsavaph
相关产品推荐
相关产品推荐

