Use WebHttpHandlerBuilder in samples
DispatcherHandler.toHttpHandler was removed
This commit is contained in:
parent
6d26b86792
commit
71b1720cfe
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -46,7 +46,8 @@ public class HelloWebfluxApplication {
|
|||
@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();
|
||||
|
|
Loading…
Reference in New Issue