spring redis 新配置风格

This commit is contained in:
Jerry Yan
2025-06-11 10:06:44 +08:00
parent 14c85838f4
commit 44bd521446
2 changed files with 27 additions and 25 deletions

View File

@@ -12,19 +12,20 @@ spring:
max-request-size: 100MB max-request-size: 100MB
cache: cache:
type: redis type: redis
# REDIS数据库配置 data:
redis: # REDIS数据库配置
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 redis:
host: 127.0.0.1 # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
# [必须修改] 端口号 host: 127.0.0.1
port: 6379 # [必须修改] 端口号
# [可选] 数据库 DB port: 6379
database: 7 # [可选] 数据库 DB
# [可选] 访问密码,若你的redis服务器没有设置密码就不需要用密码去连接 database: 7
password: luna # [可选] 访问密码,若你的redis服务器没有设置密码就不需要用密码去连接
# [可选] 超时时间 password: luna
timeout: 10000 # [可选] 超时时间
# mysql数据源 timeout: 10000
# mysql数据源
datasource: datasource:
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver

View File

@@ -6,18 +6,19 @@ spring:
max-request-size: 100MB max-request-size: 100MB
cache: cache:
type: redis type: redis
# REDIS数据库配置 data:
redis: # REDIS数据库配置
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 redis:
host: ${REDIS_HOST:127.0.0.1} # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
# [必须修改] 端口号 host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379} # [必须修改] 端口号
# [可选] 数据库 DB port: ${REDIS_PORT:6379}
database: ${REDIS_DB:6} # [可选] 数据库 DB
# [可选] 访问密码,若你的redis服务器没有设置密码就不需要用密码去连接 database: ${REDIS_DB:6}
password: ${REDIS_PWD:root} # [可选] 访问密码,若你的redis服务器没有设置密码就不需要用密码去连接
# [可选] 超时时间 password: ${REDIS_PWD:root}
timeout: 10000 # [可选] 超时时间
timeout: 10000
# [必选] jdbc数据库配置 # [必选] jdbc数据库配置
datasource: datasource:
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource