Springboot2.0整合thymeleaf和shiro

在springboot2.0中需要注意一个问题,那就是shiro和thymeleaf的支持依赖需要使用2.0.0

1、添加依赖

        <dependency>
            <groupId>com.github.theborakompanioni</groupId>
            <artifactId>thymeleaf-extras-shiro</artifactId>
            <version>2.0.0</version>
        </dependency>

2、在ShiroConfig中配置ShiroDialect

/**
     * shiro方言  支持shiro标签
     * @return
     */
    @Bean
    public ShiroDialect shiroDialect() {
        return new ShiroDialect();
    }

3、html中导入shiro标签

猜你喜欢

转载自blog.csdn.net/AinUser/article/details/81771929