2026-02-03 10:18:40 +08:00
--- #################### 注册中心 + 配置中心相关配置 ####################
spring :
cloud :
nacos :
2026-03-04 13:18:49 +08:00
server-addr : 192.168 .1 .103 : 18848 # Nacos 服务器地址
username : # Nacos 账号
password : # Nacos 密码
discovery : # 【配置中心】配置项
2026-03-31 19:35:21 +08:00
namespace : 7e15dd2b-2aa2-487d-9e80-1c01c7b9f742 # 命名空间。这里使用 dev 开发环境
2026-03-04 13:18:49 +08:00
group : DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
metadata :
version : 1.0 .0 # 服务实例的版本号,可用于灰度发布
config : # 【注册中心】配置项
2026-03-31 19:35:21 +08:00
namespace : 7e15dd2b-2aa2-487d-9e80-1c01c7b9f742 # 命名空间。这里使用 dev 开发环境
2026-03-04 13:18:49 +08:00
group : DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
#spring:
# cloud:
# nacos:
# discovery:
# enabled: false
# config:
# enabled: false
2026-02-10 15:27:28 +08:00
2026-02-03 10:18:40 +08:00
--- #################### 数据库相关配置 ####################
spring :
# 数据源配置项
autoconfigure :
exclude :
datasource :
druid : # Druid 【监控】相关的全局配置
web-stat-filter :
enabled : true
stat-view-servlet :
enabled : true
allow : # 设置白名单,不填则允许所有访问
url-pattern : /druid/*
login-username : # 控制台管理用户名和密码
login-password :
filter :
stat :
enabled : true
log-slow-sql : true # 慢 SQL 记录
slow-sql-millis : 100
merge-sql : true
wall :
config :
multi-statement-allow : true
dynamic : # 多数据源配置
druid : # Druid 【连接池】相关的全局配置
initial-size : 1 # 初始连接数
min-idle : 1 # 最小连接池数量
max-active : 20 # 最大连接池数量
max-wait : 60000 # 配置获取连接等待超时的时间, 单位: 毫秒( 1 分钟)
time-between-eviction-runs-millis : 60000 # 配置间隔多久才进行一次检测, 检测需要关闭的空闲连接, 单位: 毫秒( 1 分钟)
min-evictable-idle-time-millis : 600000 # 配置一个连接在池中最小生存的时间, 单位: 毫秒( 10 分钟)
max-evictable-idle-time-millis : 1800000 # 配置一个连接在池中最大生存的时间, 单位: 毫秒( 30 分钟)
validation-query : SELECT 1 FROM DUAL # 配置检测连接是否有效
test-while-idle : true
test-on-borrow : false
test-on-return : false
pool-prepared-statements : true # 是否开启 PreparedStatement 缓存
max-pool-prepared-statement-per-connection-size : 20 # 每个连接缓存的 PreparedStatement 数量
primary : master
datasource :
master :
2026-02-03 10:31:09 +08:00
url : jdbc:mysql://192.168.1.22:13306/msgpush?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
2026-02-03 10:18:40 +08:00
username : root
password : njcnpqs
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
data :
redis :
host : 127.0 .0 .1 # 地址
port : 16379 # 端口
database : 0 # 数据库索引
# password: njcnpqs # 密码,建议生产环境开启
--- #################### 监控相关配置 ####################
# Actuator 监控端点的配置项
management :
endpoints :
web :
base-path : /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
exposure :
include : '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
# 日志文件配置
logging :
level :
# 配置自己写的 MyBatis Mapper 打印日志
com.njcn.msgpush.module.infra.dal.mysql : debug
com.njcn.msgpush.module.infra.dal.mysql.logger.ApiErrorLogMapper : INFO # 配置 ApiErrorLogMapper 的日志级别为 info, 避免和 GlobalExceptionHandler 重复打印
com.njcn.msgpush.module.infra.dal.mysql.file.FileConfigMapper : INFO # 配置 FileConfigMapper 的日志级别为 info
org.springframework.context.support.PostProcessorRegistrationDelegate : ERROR # TODO 芋艿: 先禁用, Spring Boot 3.X 存在部分错误的 WARN 提示
--- #################### 灿能相关配置 ####################
# 灿能配置项,设置当前项目所有自定义的配置
msgpush :
env : # 多环境的配置项
tag : ${HOSTNAME}
security :
mock-enable : true
access-log : # 访问日志的配置项
enable : true