sec:authorize的使用
1、在.html页面引入spring security的命名空间 <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5"> 2、引入依赖 <dependency> <groupId>org.thymeleaf.extras</groupId> <artifactId>thymeleaf-extras-springsecurity5</artifactId> </dependency> 3、使用sec:authorize属性 <body> <p>点击<a th:href="@{/hello}">这里</a>打个招呼吧</p> <form th:action="@{/logout}" method="post"> <input type="submit" value="退出登陆"> </form> <p sec:authorize="hasRole('ROLE_admin')"><a th:href="@{/hello/helloAdmin}">管理员</a></p> <p sec:authorize="hasRole(