Spring云网关响应永远不会到来

问题描述 投票:1回答:1

我正在尝试Spring Cloud Gateway(Finchley.M5)。然后我基于Springboot 2(2.0.0.M7)构建了这个简单的项目:

  1. 尤里卡
  2. Spring Cloud Gateway
  3. 服务(WebFlux @RestController

直接询问服务时,响应按预期到达:

enter image description here

但是当我尝试通过网关请求服务时,服务接收请求(我向控制台打印了一条消息),但响应永远不会回到客户端:

enter image description here

该项目的回购已经结束:https://github.com/julianobrasil/spring-gateway-test

[编辑1]:所以你不必克隆上面的repo来看看代码发生了什么,这里是:

1 - 网关

@SpringBootApplication
@EnableDiscoveryClient
public class GatewayApplication {

    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);
    }

    @Bean
    public RouteLocator routes(RouteLocatorBuilder builder) {
        return builder.routes()
                .route(r -> r.path("/service/**")
                        .rewritePath("/service/(?<path>.*)", "/${path}")
                        .uri("lb://mySimpleService"))
                .build();
    }
}

2 - 服务控制器

@RestController
public class MyController {

    @GetMapping("/test")
    Mono<String> getHello() {
        System.out.println("I received a connection request");
        return Mono.just("Hello, world!");
    }
}

[编辑2]:Spring Cloud团队的某个人克隆了我的回购并进行了测试。并报告说它工作得很好。显然测试是在linux系统中进行的(我在windows 10机器上运行它)。

spring-boot spring-cloud
1个回答
1
投票

我发现真正的问题是典型的Windows世界问题:防病毒。卡巴斯基对http的回应很沮丧。敬启者:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.