Files
cn-rdms/rdms-project/rdms-project-boot/src/main/resources/application.yaml
hongawen b4f6eab64c config(gateway): 配置中心和日志配置外置到Nacos
- 添加Nacos配置中心依赖并启用配置导入功能
- 将网关日志配置外置到Nacos gateway-server.yaml文件
- 将业务模块日志文件路径配置外置到Nacos rdms-common.yaml
- 在pom.xml中设置addResources为false避免占位符不被替换
- 添加logback-spring.xml配置文件用于日志格式化和滚动策略
- 优化日志配置管理方式,实现按环境统一配置
2026-06-22 14:10:29 +08:00

142 lines
4.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

spring:
application:
name: rdms-project-server
main:
allow-circular-references: true # 允许循环依赖,因为项目当前沿用三层架构组织方式。
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如 Feign 等会存在重复定义的服务
cloud:
# 注册中心 + 配置中心连接(值由根 pom 的 nacos.* 属性在打包时注入)
nacos:
server-addr: @nacos.server-addr@
username: @nacos.username@
password: @nacos.password@
discovery:
namespace: @nacos.namespace@
group: @nacos.group@
metadata:
version: ${rdms.info.version} # 灰度发布用的实例版本号
config:
namespace: @nacos.namespace@
group: @nacos.group@
config:
import:
- nacos:rdms-common.yaml # 公共非敏感配置(数据库地址/Redis/开关等)
- nacos:rdms-common-secret.yaml # 公共敏感配置(数据库账密/加解密秘钥)
# Servlet 配置
servlet:
# 文件上传相关配置项
multipart:
max-file-size: 16MB # 单个文件大小
max-request-size: 32MB # 设置总上传的文件大小
# Jackson 配置项
jackson:
serialization:
write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳
write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式,例如 1611460870401
write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
fail-on-empty-beans: false # 允许序列化无属性的 Bean
# Cache 配置项
cache:
type: REDIS
redis:
time-to-live: 1h # 设置过期时间为 1 小时
data:
redis:
repositories:
enabled: false # 项目未使用到 Spring Data Redis 的 Repository所以直接禁用保证启动速度
# 热部署配置
devtools:
restart:
enabled: true
server:
port: 48082
tomcat:
# 长连接保活时长:默认沿用 connection-timeout(20s),过短会和网关侧 HttpClient 连接池形成 race
# 导致网关复用已被服务端关闭的连接抛 PrematureCloseException。
# 必须大于网关 spring.cloud.gateway.server.webflux.httpclient.pool.max-idle-time(30s)。
keep-alive-timeout: 60s
logging:
# 日志文件路径logging.file.name已外置到 Nacos rdms-common.yaml按环境统一配置本地不再定义以免覆盖 Nacos。
level:
com.njcn.rdms.module.project.dal.mysql: debug # 打印本模块 Mapper 的 SQL 日志
--- #################### 接口文档配置 ####################
springdoc:
api-docs:
enabled: true # 1. 是否开启 Swagger 接口文档的元数据
path: /v3/api-docs
swagger-ui:
enabled: true # 2.1 是否开启 Swagger 文档的官方 UI 界面
path: /swagger-ui
default-flat-param-object: true
knife4j:
enable: true
setting:
language: zh_cn
# MyBatis Plus 的配置项
mybatis-plus:
configuration:
map-underscore-to-camel-case: true # 虽然默认为 true但是还是显示指定下。
global-config:
db-config:
id-type: ASSIGN_ID # 分配 ID默认使用雪花算法
logic-delete-value: 1 # 逻辑已删除值(默认为 1
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0
banner: false # 关闭控制台的 Banner 打印
type-aliases-package: ${rdms.info.base-package}.dal.dataobject
# encryptor.password@EncryptField 字段加解密秘钥)已外置到 Nacos rdms-common-secret.yaml不再硬编码进 git
mybatis-plus-join:
banner: false # 关闭控制台的 Banner 打印
# VO 转换(数据翻译)相关
easy-trans:
is-enable-global: false # 默认禁用全局翻译,避免额外性能开销
--- #################### RDMS 相关配置 ####################
rdms:
info:
version: 1.0.0
base-package: com.njcn.rdms.module.project
web:
admin-ui:
url: https://www.baidu.com # Admin 管理后台 UI 的占位地址,联调时替换成实际前端入口
xss:
enable: false
exclude-urls:
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
swagger:
title: 项目交付域管理后台
description: 提供项目集、项目、产品、需求、任务、工单、执行等管理能力
author: RDMS
version: ${rdms.info.version}
url: https://example.com
email: dev@example.com
license: Apache 2.0
license-url: https://www.apache.org/licenses/LICENSE-2.0.html
work-report:
auto-gen:
enabled: true
weekly:
enabled: true
cron: "0 0 12 ? * FRI"
monthly:
enabled: true
cron: "0 0 12 1-31 * ?"
project:
enabled: true
cron: "0 0 12 1-31 * ?"
scope:
dept-ids: [100]
performance:
score-cell-mapping:
actual-score-total: J10
base-score-total: K10
extra-score-total: L10
debug: false