SpringBoot 整合shiro

1. 创建springboot项目,设置依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.apache.shiro</groupId>
    <artifactId>shiro-spring-boot-web-starter</artifactId>
    <version>1.4.0</version>
</dependency>

2. 创建 Realm

SpringBoot 整合shiro

SpringBoot 整合shiro

SpringBoot 整合shiro

6. 测试

访问:http://localhost:8080/login

         http://localhost:8080/hello

在没登录认证的情况下,访问任何路径都会跳到http://localhost:8080/login

在postman中登录

登录

SpringBoot 整合shiro

 

 

相关文章: