开启Redis对Session缓存

2023-05-04 19:06:01 浏览数 (1)

1.

代码语言:javascript复制
#增加配置类 自动开启
@Configuration
@EnableRedisHttpSession
public class RedisSessionManager {

	
}

2.

代码语言:javascript复制
#依赖
<dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-data-redis</artifactId>
           <version>2.4.5</version>
       </dependency>
       
     <dependency>
        <groupId>org.springframework.session</groupId>
        <artifactId>spring-session-data-redis</artifactId>
     </dependency>

3.

代码语言:javascript复制
spring
  redis:
     cluster:
        nodes: 127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6389,127.0.0.1:6390,192.168.37.129:639

0 人点赞