WebFlux Q&A

1.按照官方示例中的函数式编程风格,有一段如下代码:

    public HttpServer getHttpServer(){
        HttpHandler httpHandler = RouterFunctions.toHttpHandler(router3);
        ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler);
        HttpServer server = HttpServer.create("localhost", 9000);
        server.newHandler(adapter);
        return server;
    }

在测试的过程中发现 没有这段代码也可运行:文档原话:This starter also supports the functional web API and will detect automatically RouterFunction beans.

你可能感兴趣的:(WebFlux Q&A)