|
@@ -21,8 +21,8 @@ import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.context.annotation.*;
|
|
|
import org.springframework.http.server.reactive.HttpHandler;
|
|
|
import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
|
|
|
-import org.springframework.web.reactive.DispatcherHandler;
|
|
|
import org.springframework.web.reactive.config.EnableWebFlux;
|
|
|
+import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
|
|
|
import reactor.ipc.netty.NettyContext;
|
|
|
import reactor.ipc.netty.http.server.HttpServer;
|
|
|
|
|
@@ -47,7 +47,8 @@ public class HelloWebfluxMethodApplication {
|
|
|
@Profile("default")
|
|
|
@Bean
|
|
|
public NettyContext nettyContext(ApplicationContext context) {
|
|
|
- HttpHandler handler = DispatcherHandler.toHttpHandler(context);
|
|
|
+ HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context)
|
|
|
+ .build();
|
|
|
ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
|
|
|
HttpServer httpServer = HttpServer.create("localhost", port);
|
|
|
return httpServer.newHandler(adapter).block();
|