http://localhost:8088/setSession

引入 Spring Session 依赖

  1. <dependency>
  2. <groupId>org.springframework.session</groupId>
  3. <artifactId>spring-session-data-redis</artifactId>
  4. </dependency>
  5. <dependency>
  6. <groupId>org.springframework.boot</groupId>
  7. <artifactId>spring-boot-starter-security</artifactId>
  8. </dependency>

配置存储类型

  1. spring:
  2. session:
  3. store-type: redis

开启redis作为spring session

  1. @EnableRedisHttpSession // 开启使用redis作为spring session

去除安全自动装配

  1. @SpringBootApplication(exclude = {SecurityAutoConfiguration.class})