你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

解决security-thymeleaf整合时 sec标签没有提示问题

2021/12/19 13:46:52

本人 S p r i n g B o o t SpringBoot SpringBoot使用 2.1.7. R E L E A S E 2.1.7.RELEASE 2.1.7.RELEASE版本

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.7.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

确定引入正确的依赖包

<!--security 和 thymeleaf整合包-->
<dependency>
    <groupId>org.thymeleaf.extras</groupId>
    <artifactId>thymeleaf-extras-springsecurity5</artifactId>
    <version>3.0.4.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

html中引入命名空间

<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">

然后就可以看到提示了!

在这里插入图片描述