1.首先第一步導入依賴
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>1.2.1</version>
</dependency>
2.ftl頁面中引入命名空間
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
3.ftl頁面中使用標籤
<@shiro.hasRole name="merchants">
<div>
我有這個角色哦!
</div>
</@shiro.hasRole>