1.thymeleaf-extras-shiro
根据当前用户的权限显示对应的标签
1.导入依赖
<!--thymeleaf shiro 根据权限标签显示-->
<!--shiro与themeleaf集成-->
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>2.0.0</version>
</dependency>
2.在ShiroConfiguration 配置
@Bean
public ShiroDialect shiroDialect() {
return new ShiroDialect();
}
3. 导入shiro标签
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h3>index</h3>
<div>
<a href="/user/add"> 增加用户</a>
<a href="/user/logout"> 注销</a>
<br>
<a href="/goods/add">增加商品</a>
<a href="/goods/delete">删除商品</a>
<a href="/goods/update">更新商品</a>
<a href="/goods/get">获取单个商品</a>
<a href="/goods/getAllGoods"