WebFlux Q&A

2018-04-01  本文已影响0人  有bear来啊

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.

上一篇 下一篇

猜你喜欢

热点阅读