添加依赖
<dependency><groupId>com.github.theborakompanioni</groupId> <artifactId>thymeleaf-extras-shiro</artifactId> <version>
1.2.1</version> </dependency>
在shiro的configuration中配置
@Bean public ShiroDialect shiroDialect() { return new ShiroDialect(); }
在html中加入xmlns
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
例子
<button shiro:hasPermission="sys:user:add" type="button" class="btn btn-primary" onclick="add()"> <i class="fa fa-plus" aria-hidden="true"></i>添加 </button>