From 71b1720cfe0cc3aba39542e800cf64bdc345756c Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Fri, 22 Sep 2017 20:36:34 -0500 Subject: [PATCH] Use WebHttpHandlerBuilder in samples DispatcherHandler.toHttpHandler was removed --- .../src/main/java/sample/HelloWebfluxMethodApplication.java | 5 +++-- .../src/main/java/sample/HelloWebfluxApplication.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/samples/javaconfig/hellowebflux-method/src/main/java/sample/HelloWebfluxMethodApplication.java b/samples/javaconfig/hellowebflux-method/src/main/java/sample/HelloWebfluxMethodApplication.java index 7671cce002..0d068142d8 100644 --- a/samples/javaconfig/hellowebflux-method/src/main/java/sample/HelloWebfluxMethodApplication.java +++ b/samples/javaconfig/hellowebflux-method/src/main/java/sample/HelloWebfluxMethodApplication.java @@ -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(); diff --git a/samples/javaconfig/hellowebflux/src/main/java/sample/HelloWebfluxApplication.java b/samples/javaconfig/hellowebflux/src/main/java/sample/HelloWebfluxApplication.java index f468deccc9..fd2db5edb8 100644 --- a/samples/javaconfig/hellowebflux/src/main/java/sample/HelloWebfluxApplication.java +++ b/samples/javaconfig/hellowebflux/src/main/java/sample/HelloWebfluxApplication.java @@ -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();