加入坐标
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
在application.yml配置
spring:
# 选择redis为session存储
session:
store-type: redis
# 配置redis
redis:
host: 127.0.0.1
password: liuxiuhui
port: 6379
# springsSession过期时间
server:
servlet:
session:
timeout: 30m
在主方法加上注解@EnableRedisHttpSession
开启spring session
package com.liu.sso;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.