Skip to content

Commit d43535e

Browse files
committed
新增功能 - 后端支持持久化登录态(整合 Redis)
1 parent 3e4edb6 commit d43535e

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@
3434
<groupId>org.springframework.boot</groupId>
3535
<artifactId>spring-boot-starter-web</artifactId>
3636
</dependency>
37+
<!-- Spring Data Redis Session -->
38+
<dependency>
39+
<groupId>org.springframework.boot</groupId>
40+
<artifactId>spring-boot-starter-data-redis</artifactId>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.springframework.session</groupId>
44+
<artifactId>spring-session-data-redis</artifactId>
45+
</dependency>
3746
<dependency>
3847
<groupId>cn.hutool</groupId>
3948
<artifactId>hutool-all</artifactId>

src/main/resources/application.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,19 @@ spring:
88
url: jdbc:mysql://localhost:3306/coder-test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
99
username: root
1010
password: 123456
11+
# Redis 配置
12+
data:
13+
redis:
14+
host: localhost
15+
port: 6379
16+
database: 0
17+
timeout: 3000ms
18+
# Session 配置
1119
session:
12-
timeout: 86400
13-
store-type: memory
20+
store-type: redis
21+
timeout: 86400s
22+
redis:
23+
namespace: spring:session
1424
server:
1525
port: 8123
1626
servlet:

0 commit comments

Comments
 (0)