需求緣起
在訪問/index頁面,user用戶不應該能夠看到admin page的鏈接,針對這個問題可以通過sec:authorize標籤進行控制。
一、標籤sec:authorize的使用
1.1 引入依賴
在pom.xml文件中添加依賴:
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
1.2