我的spring-boot版本为2.3.1.RELEASE,导入thymeleaf-extras-springsecurity4后发现页面的sec:authorize="isAuthenticated()"不生效,然后就改为了thymeleaf-extras-springsecurity5,具体步骤
1.导入依赖
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
页面添加 (和springsecurity4有所区别)
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
然后页面正常显示