After springboot2.x version, springsecurity's sec:authorize and other attributes cannot take effect

When springboot integrates thymeleaf and springsecurity, the instructional video lets us introduce the following dependencies, and then attributes such as sec:authorize do not work
ps.教学视频的springboot版本为1.5.x

<dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity4</artifactId>
            <version>3.0.2.RELEASE</version>
        </dependency>

springboot2.x后,springsecurity版本升级到5, Therefore, just modify the springsecurity version

<dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
           <version>3.0.4.RELEASE</version>
        </dependency>

Also modify here

<html xmlns:th="http://www.thymeleaf.org"
	  xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">

This article refers to the problem that sec:authorize is invalid after SpringBoot 2.1.4 integrates thymeleaf and springsecurity , and the pro-test is valid

Guess you like

Origin blog.csdn.net/m0_46267375/article/details/108586905