diff --git a/labx-08/labx-08-sc-gateway-demo01-test/src/main/java/cn/iocoder/springcloud/labx08/gatewaydemo/config/GatewayConfig.java b/labx-08/labx-08-sc-gateway-demo01-test/src/main/java/cn/iocoder/springcloud/labx08/gatewaydemo/config/GatewayConfig.java index 84bfe2af9..eca19a8af 100644 --- a/labx-08/labx-08-sc-gateway-demo01-test/src/main/java/cn/iocoder/springcloud/labx08/gatewaydemo/config/GatewayConfig.java +++ b/labx-08/labx-08-sc-gateway-demo01-test/src/main/java/cn/iocoder/springcloud/labx08/gatewaydemo/config/GatewayConfig.java @@ -4,11 +4,10 @@ import org.slf4j.LoggerFactory; import org.springframework.cloud.gateway.filter.GlobalFilter; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; import reactor.core.publisher.Mono; -@Configuration +//@Configuration public class GatewayConfig { private Logger logger = LoggerFactory.getLogger(GatewayConfig.class); diff --git a/labx-08/labx-08-sc-gateway-demo01-test/src/main/resources/application.yaml b/labx-08/labx-08-sc-gateway-demo01-test/src/main/resources/application.yaml index 1f1bf3e23..4f641b7fa 100644 --- a/labx-08/labx-08-sc-gateway-demo01-test/src/main/resources/application.yaml +++ b/labx-08/labx-08-sc-gateway-demo01-test/src/main/resources/application.yaml @@ -27,3 +27,14 @@ spring: # - StripPrefix=1 # - StripPrefix=2 # - StripPrefix=3 + +# httpserver: +# wiretap: true +# httpclient: +# wiretap: true + +logging: + level: + reactor.netty: DEBUG + org.springframework.cloud.gateway: TRACE +# org.springframework.web.reactive: TRACE diff --git a/labx-08/labx-08-sc-gateway-demo10-troubleshooting/pom.xml b/labx-08/labx-08-sc-gateway-demo10-troubleshooting/pom.xml new file mode 100644 index 000000000..5342efed2 --- /dev/null +++ b/labx-08/labx-08-sc-gateway-demo10-troubleshooting/pom.xml @@ -0,0 +1,58 @@ + + + + labx-08 + cn.iocoder.springboot.labs + 1.0-SNAPSHOT + + 4.0.0 + + labx-08-sc-gateway-demo10-troubleshooting + + + 2.2.4.RELEASE + Hoxton.SR1 + 2.2.0.RELEASE + + + + + + + org.springframework.boot + spring-boot-starter-parent + ${spring.boot.version} + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + ${spring.cloud.version} + pom + import + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + ${spring.cloud.alibaba.version} + pom + import + + + + + + + + org.springframework.cloud + spring-cloud-starter-gateway + + + + diff --git a/labx-08/labx-08-sc-gateway-demo10-troubleshooting/src/main/java/cn/iocoder/springcloud/labx08/gatewaydemo/GatewayApplication.java b/labx-08/labx-08-sc-gateway-demo10-troubleshooting/src/main/java/cn/iocoder/springcloud/labx08/gatewaydemo/GatewayApplication.java new file mode 100644 index 000000000..f9575ef3e --- /dev/null +++ b/labx-08/labx-08-sc-gateway-demo10-troubleshooting/src/main/java/cn/iocoder/springcloud/labx08/gatewaydemo/GatewayApplication.java @@ -0,0 +1,13 @@ +package cn.iocoder.springcloud.labx08.gatewaydemo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class GatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class, args); + } + +} diff --git a/labx-08/labx-08-sc-gateway-demo10-troubleshooting/src/main/resources/application.yaml b/labx-08/labx-08-sc-gateway-demo10-troubleshooting/src/main/resources/application.yaml new file mode 100644 index 000000000..8aaebf8de --- /dev/null +++ b/labx-08/labx-08-sc-gateway-demo10-troubleshooting/src/main/resources/application.yaml @@ -0,0 +1,35 @@ +server: + port: 8888 + +spring: + application: + name: gateway-application + + cloud: + # Spring Cloud Gateway 配置项,对应 GatewayProperties 类 + gateway: + # 路由配置项,对应 RouteDefinition 数组 + routes: + - id: yudaoyuanma # 路由的编号 + uri: http://www.iocoder.cn # 路由到的目标地址 + predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组 + - Path=/blog + filters: + - StripPrefix=1 + - id: oschina # 路由的编号 + uri: https://www.oschina.net # 路由的目标地址 + predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组 + - Path=/oschina + filters: # 过滤器,对请求进行拦截,实现自定义的功能,对应 FilterDefinition 数组 + - StripPrefix=1 + + # Reactor Netty 相关配置 + httpserver: + wiretap: true + httpclient: + wiretap: true + +logging: + level: + reactor.netty: DEBUG + org.springframework.cloud.gateway: TRACE diff --git a/labx-08/pom.xml b/labx-08/pom.xml index f078db08d..fd190eed8 100644 --- a/labx-08/pom.xml +++ b/labx-08/pom.xml @@ -33,6 +33,8 @@ labx-08-sc-gateway-demo09-actuator + labx-08-sc-gateway-demo10-troubleshooting + labx-08-sc-user-service