Spring Cloud Gateway Простой пример не работает - PullRequest
0 голосов
/ 27 июня 2019

Самое основное приложение Spring Cloud Gateway не работает.

application.yml

server:
    port: 9000

GatewayApplication.java

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

    @Bean
    public RouteLocator routeLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route("test", r -> r.path("/test")
                        .uri("http://httpbin.org:80"))
                .build();
    }
}

Почтальон: http://localhost:9000/test

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server.  If you entered the URL         
manually please check your spelling and try again.</p>

Почтальон: http://localhost:9000/test2

{
   "timestamp": "2019-06-26T22:24:34.208+0000",
   "path": "/test2",
   "status": 404,
   "error": "Not Found",
   "message": null
}
...