chore(gateway, ping-service, security): streamline configurations, remove redundancies, and improve resilience

- Removed `MdcCorrelationFilter` and simplified correlation ID management using Micrometer Tracing.
- Updated `SecurityConfig` in `gateway` with enhanced role-based access and standardized JWT validation.
- Added new `@Profile` annotations in `ping-service` to exclude certain components during testing.
- Refactored and removed legacy `application-keycloak.yaml` and consolidated settings into the primary `application.yaml`.
- Adjusted Gradle scripts to clean up dependency declarations and improve modularity.
- Simplified CORS and Gateway route configurations for better maintainability.
This commit is contained in:
2026-01-16 21:31:56 +01:00
parent 05962487e7
commit 18f7794a90
19 changed files with 282 additions and 375 deletions
@@ -1,58 +1,23 @@
spring:
application:
name: gateway
name: "gateway"
autoconfigure:
exclude:
- org.springframework.boot.restclient.autoconfigure.RestClientAutoConfiguration
- org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration
- "org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration"
cloud:
gateway:
globalcors:
cors-configurations:
'[/**]':
allowed-origin-patterns: "http://localhost:*,http://127.0.0.1:*"
allowed-methods:
- GET
- POST
- PUT
- DELETE
- OPTIONS
allowed-headers: "*"
allow-credentials: true
max-age: 3600
httpclient:
connect-timeout: 3000
response-timeout: 5s
routes:
- id: ping-service
# Nutze lb:// wenn Service Discovery aktiv ist, sonst http://hostname:port
# Da wir Consul nutzen, ist lb://ping-service besser, aber für Tracer Bullet
# und direkte Docker-Kommunikation ist http://ping-service:8082 sicherer,
# falls Consul noch nicht 100% stabil ist.
# Wir nutzen hier den Docker Alias und den konfigurierten Port.
uri: http://ping-service:8082
predicates:
- Path=/api/ping/**
filters:
- StripPrefix=1
- name: CircuitBreaker
args:
name: pingServiceCB
fallbackUri: forward:/fallback/ping
# Wir nutzen die Standard-HTTP-Client-Konfiguration (Reactor Netty Defaults).
# Explizite Timeouts oder Pool-Settings können bei Bedarf über System-Properties
# oder spezifische Beans gesetzt werden, um Deprecation-Warnungen in YAML zu vermeiden.
httpclient: {}
management:
endpoints:
web:
exposure:
include: health,info,prometheus
include: "health,info,prometheus"
tracing:
sampling:
probability: 1.0
propagation:
type: w3c
gateway:
ratelimit:
enabled: false
replenish-rate: 10
burst-capacity: 20
type: "w3c"