feat: create manage-gateway module structure

This commit is contained in:
张翔
2026-03-13 12:49:12 +08:00
parent a12638c567
commit e7148498ad
7 changed files with 162 additions and 0 deletions
@@ -0,0 +1,24 @@
package cn.novalon.manage.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder.routes()
.route("manage-app", r -> r
.path("/api/**")
.uri("http://manage-app:8081"))
.build();
}
}
@@ -0,0 +1,13 @@
spring:
cloud:
gateway:
routes:
- id: manage-app
uri: http://localhost:8081
predicates:
- Path=/api/**
logging:
level:
org.springframework.cloud.gateway: TRACE
org.springframework.web.reactive: TRACE
@@ -0,0 +1,13 @@
spring:
cloud:
gateway:
routes:
- id: manage-app
uri: http://manage-app:8081
predicates:
- Path=/api/**
logging:
level:
cn.novalon.manage: INFO
org.springframework.cloud.gateway: INFO
@@ -0,0 +1,42 @@
server:
port: 8080
spring:
application:
name: manage-gateway
cloud:
gateway:
routes:
- id: manage-app
uri: http://manage-app:8081
predicates:
- Path=/api/**
default-filters:
- name: Retry
args:
retries: 3
statuses: BAD_GATEWAY,SERVICE_UNAVAILABLE
methods: GET,POST
backoff:
firstBackoff: 10ms
maxBackoff: 50ms
factor: 2
basedOnPreviousValue: false
management:
endpoints:
web:
exposure:
include: health,info,metrics
base-path: /actuator
endpoint:
health:
show-details: always
metrics:
tags:
application: ${spring.application.name}
logging:
level:
cn.novalon.manage: DEBUG
org.springframework.cloud.gateway: DEBUG