1. First step is to import dependencies
<dependency> <groupId>com.github.theborakompanioni</groupId> <artifactId>thymeleaf-extras-shiro</artifactId> <version>1.2.1</version> </dependency>
2. Add in the method to configure shiro permissions
@Bean public ShiroDialect shiroDialect() { return new ShiroDialect(); }3.Introduce namespace in ftl page
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
4. Use tags in ftl page
<@shiro.hasRole name="merchants"> <div> I have this role! </div> </@shiro.hasRole>
Summarize
The above is the example code of springboot using shiro tags on the ftl page introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support to Wulin.com website!