zhangjf 8e4afcd1a5 feat: TenantAwareLoadBalancer 整合 TenantRoutingProperties 配置
问题:TenantRoutingProperties 定义了配置但未被使用

解决方案:
1. TenantAwareLoadBalancer 注入 TenantRoutingProperties
   - 使用配置的 tenantHeader 名称
   - 使用配置的 buildTenantGroup 方法
   - 使用配置的 isSharedService 判断
   - 使用配置的 isFallbackToShared 策略

2. 新增功能
   - 支持 enabled=false 禁用租户路由
   - 共享服务跳过租户过滤
   - 可配置是否回退到共享实例

3. 更新测试适配新构造函数
2026-02-19 21:02:25 +08:00

104 lines
2.3 KiB
YAML

server:
port: 8000
spring:
application:
name: fund-gateway
# Redis配置(用于限流)
data:
redis:
host: localhost
port: 6379
password: zjf@123456
database: 1
cloud:
compatibility-verifier:
enabled: false
# Sentinel配置
sentinel:
transport:
dashboard: localhost:8080 # Sentinel Dashboard地址(可选)
port: 8719 # Sentinel客户端端口
eager: true # 服务启动时立即初始化
gateway:
# 默认限流配置
default-filters:
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 100 # 每秒补充令牌数
redis-rate-limiter.burstCapacity: 200 # 令牌桶最大容量
key-resolver: "#{@ipKeyResolver}"
routes:
# 系统管理服务
- id: fund-sys
uri: http://localhost:8100
predicates:
- Path=/sys/**
filters:
- StripPrefix=1
# 客户管理服务
- id: fund-cust
uri: http://localhost:8200
predicates:
- Path=/cust/**
filters:
- StripPrefix=1
# 项目管理服务
- id: fund-proj
uri: http://localhost:8120
predicates:
- Path=/proj/**
filters:
- StripPrefix=1
# 用款申请服务
- id: fund-req
uri: http://localhost:8800
predicates:
- Path=/req/**
filters:
- StripPrefix=1
# 支出管理服务
- id: fund-exp
uri: http://localhost:8140
predicates:
- Path=/exp/**
filters:
- StripPrefix=1
# 收款管理服务
- id: fund-receipt
uri: http://localhost:8150
predicates:
- Path=/receipt/**
filters:
- StripPrefix=1
# 报表服务
- id: fund-report
uri: http://localhost:8700
predicates:
- Path=/report/**
filters:
- StripPrefix=1
# 文件服务
- id: fund-file
uri: http://localhost:8600
predicates:
- Path=/file/**
filters:
- StripPrefix=1
logging:
level:
org.springframework.cloud.gateway: DEBUG