1、pom文件添加依赖
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
2、application.properties中添加配置
#redis config
spring.redis.cluster.nodes=10.10.13.192:6400,10.10.13.192:6401,10.10.13.192:6402,10.10.13.193:6500,10.10.13.193:6501,10.10.13.193:6502,10.10.13.194:6600,10.10.13.194:6601,10.10.13.194:6602
#spring.redis.port=6400
#spring.redis.host=10.10.13.192
#spring.redis.password=******
spring.redis.pool.max-active=100
spring.redis.pool.max-idle=5
spring.redis.pool.max-wait=60000
#
#
spring.session.store-type=redis