pom.xml
<!-- https://mvnrepository.com/artifact/com.github.theborakompanioni/thymeleaf-extras-shiro -->
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>2.0.0</version>
</dependency>
shiro configuration类
@Bean
public ShiroDialect shiroDialect() {
return new ShiroDialect();
}
页面引入
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
...
<div shiro:hasPermission="add">
<a th:href="@{/add}">新增</a>
</div>
...
</html>