2026-03-11 19:32:37 +08:00
|
|
|
|
spring:
|
|
|
|
|
|
application:
|
|
|
|
|
|
name: gateway-server
|
|
|
|
|
|
|
|
|
|
|
|
profiles:
|
|
|
|
|
|
active: local
|
|
|
|
|
|
|
|
|
|
|
|
http:
|
|
|
|
|
|
codecs:
|
|
|
|
|
|
max-in-memory-size: 10MB # 调整缓冲区大小https://gitee.com/zhijiantianya/rdms-cloud/pulls/176
|
|
|
|
|
|
|
|
|
|
|
|
# Jackson 配置项
|
|
|
|
|
|
jackson:
|
|
|
|
|
|
serialization:
|
|
|
|
|
|
write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳
|
|
|
|
|
|
write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401
|
|
|
|
|
|
write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
|
|
|
|
|
|
fail-on-empty-beans: false # 允许序列化无属性的 Bean
|
|
|
|
|
|
|
|
|
|
|
|
main:
|
|
|
|
|
|
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
|
|
|
|
|
|
|
|
|
|
|
config:
|
|
|
|
|
|
import:
|
|
|
|
|
|
- optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
|
|
|
|
|
|
- optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置
|
|
|
|
|
|
|
|
|
|
|
|
cloud:
|
|
|
|
|
|
# Spring Cloud Gateway 配置项,对应 GatewayProperties 类
|
|
|
|
|
|
gateway:
|
|
|
|
|
|
server:
|
|
|
|
|
|
webflux:
|
2026-05-18 08:28:33 +08:00
|
|
|
|
# HttpClient 连接池配置:网关作为反向代理客户端,复用到下游服务的 keep-alive 连接。
|
|
|
|
|
|
# 必须保证 max-idle-time < 下游 server.tomcat.keep-alive-timeout(当前下游为 60s),
|
|
|
|
|
|
# 否则服务端先 FIN、网关池仍持有"已死连接",复用时会抛 reactor.netty.http.client.PrematureCloseException。
|
|
|
|
|
|
httpclient:
|
|
|
|
|
|
connect-timeout: 10000 # 建立连接超时,毫秒
|
|
|
|
|
|
response-timeout: 30s # 接收响应超时
|
|
|
|
|
|
pool:
|
|
|
|
|
|
max-idle-time: 30s # 闲置连接最长保留 30s,严格小于下游 keep-alive-timeout(60s)
|
|
|
|
|
|
evict-in-background: 60s # 周期后台驱逐过期连接,进一步降低 race 概率
|
2026-03-11 19:32:37 +08:00
|
|
|
|
# 路由配置项,对应 RouteDefinition 数组
|
|
|
|
|
|
routes:
|
|
|
|
|
|
## system-server 服务
|
|
|
|
|
|
- id: system-admin-api # 路由的编号
|
|
|
|
|
|
uri: grayLb://rdms-system-server
|
|
|
|
|
|
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
|
|
|
|
|
- Path=/admin-api/system/**
|
|
|
|
|
|
filters:
|
|
|
|
|
|
- RewritePath=/admin-api/system/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
|
|
|
|
|
|
- id: system-app-api # 路由的编号
|
|
|
|
|
|
uri: grayLb://rdms-system-server
|
|
|
|
|
|
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
|
|
|
|
|
- Path=/app-api/system/**
|
|
|
|
|
|
filters:
|
|
|
|
|
|
- RewritePath=/app-api/system/v3/api-docs, /v3/api-docs
|
|
|
|
|
|
- id: system-websocket # 路由的编号(WebSocket)
|
|
|
|
|
|
uri: grayLb://rdms-system-server
|
|
|
|
|
|
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
|
|
|
|
|
- Path=/system/ws/**
|
2026-04-18 14:19:45 +08:00
|
|
|
|
## project-server 服务
|
|
|
|
|
|
- id: project-admin-api # 路由的编号
|
|
|
|
|
|
uri: grayLb://rdms-project-server
|
|
|
|
|
|
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
|
|
|
|
|
- Path=/admin-api/project/**
|
|
|
|
|
|
filters:
|
|
|
|
|
|
- RewritePath=/admin-api/project/v3/api-docs, /v3/api-docs
|
|
|
|
|
|
- id: project-app-api # 路由的编号
|
|
|
|
|
|
uri: grayLb://rdms-project-server
|
|
|
|
|
|
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
|
|
|
|
|
- Path=/app-api/project/**
|
|
|
|
|
|
filters:
|
|
|
|
|
|
- RewritePath=/app-api/project/v3/api-docs, /v3/api-docs
|
2026-03-11 19:32:37 +08:00
|
|
|
|
## bpm-server 服务
|
|
|
|
|
|
- id: bpm-admin-api # 路由的编号
|
|
|
|
|
|
uri: grayLb://rdms-bpm-server
|
|
|
|
|
|
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
|
|
|
|
|
- Path=/admin-api/bpm/**
|
|
|
|
|
|
filters:
|
|
|
|
|
|
- RewritePath=/admin-api/bpm/v3/api-docs, /v3/api-docs
|
|
|
|
|
|
x-forwarded:
|
|
|
|
|
|
prefix-enabled: false # 避免 Swagger 重复带上额外的 /admin-api/system 前缀
|
|
|
|
|
|
default-filters:
|
|
|
|
|
|
- DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin # 采用 https://github.com/spring-cloud/spring-cloud-gateway/pull/866 解决响应头重复问题
|
|
|
|
|
|
|
|
|
|
|
|
server:
|
|
|
|
|
|
port: 48080
|
|
|
|
|
|
|
|
|
|
|
|
logging:
|
|
|
|
|
|
file:
|
|
|
|
|
|
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
|
|
|
|
|
|
|
|
|
|
|
|
knife4j:
|
|
|
|
|
|
# 聚合 Swagger 文档,参考 https://doc.xiaominfo.com/docs/action/springcloud-gateway 文档
|
|
|
|
|
|
gateway:
|
|
|
|
|
|
enabled: true
|
|
|
|
|
|
routes:
|
|
|
|
|
|
- name: system-server
|
|
|
|
|
|
service-name: rdms-system-server
|
|
|
|
|
|
url: /admin-api/system/v3/api-docs
|
2026-04-18 14:19:45 +08:00
|
|
|
|
- name: project-server
|
|
|
|
|
|
service-name: rdms-project-server
|
|
|
|
|
|
url: /admin-api/project/v3/api-docs
|
2026-03-11 19:32:37 +08:00
|
|
|
|
- name: bpm-server
|
|
|
|
|
|
service-name: bpm-server
|
|
|
|
|
|
url: /admin-api/bpm/v3/api-docs
|
|
|
|
|
|
|
|
|
|
|
|
--- #################### 灿能相关配置 ####################
|
|
|
|
|
|
|
|
|
|
|
|
rdms:
|
|
|
|
|
|
info:
|
2026-03-12 16:25:24 +08:00
|
|
|
|
version: 1.0.0
|