Remove DispatcherHandler static factory methods
The typical way to load DispatcherHandler is to use WebHttpHandlerBuilder#applicationContext which also detecs filters, exception handlers, as well as other beans that are injected into every ServerWebExchange -- custom session manager, localecontext resolver, codecs for form data, multipart data, etc WebHttpHandlerBuilder is the preferred and way so removing the ones on DispatcherHandler. They could always be added back later.
This commit is contained in:
@@ -28,10 +28,10 @@ import org.springframework.http.server.reactive.bootstrap.ReactorHttpServer;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.reactive.DispatcherHandler;
|
||||
import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Integration tests that demonstrate running multiple applications under
|
||||
@@ -55,8 +55,8 @@ public class ContextPathIntegrationTests {
|
||||
context2.register(WebApp2Config.class);
|
||||
context2.refresh();
|
||||
|
||||
HttpHandler webApp1Handler = DispatcherHandler.toHttpHandler(context1);
|
||||
HttpHandler webApp2Handler = DispatcherHandler.toHttpHandler(context2);
|
||||
HttpHandler webApp1Handler = WebHttpHandlerBuilder.applicationContext(context1).build();
|
||||
HttpHandler webApp2Handler = WebHttpHandlerBuilder.applicationContext(context2).build();
|
||||
|
||||
this.server = new ReactorHttpServer();
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ import org.springframework.web.reactive.socket.server.upgrade.ReactorNettyReques
|
||||
import org.springframework.web.reactive.socket.server.upgrade.RxNettyRequestUpgradeStrategy;
|
||||
import org.springframework.web.reactive.socket.server.upgrade.TomcatRequestUpgradeStrategy;
|
||||
import org.springframework.web.reactive.socket.server.upgrade.UndertowRequestUpgradeStrategy;
|
||||
import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
|
||||
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
@@ -160,7 +161,7 @@ public abstract class AbstractWebSocketIntegrationTests {
|
||||
context.register(DispatcherConfig.class, this.serverConfigClass);
|
||||
context.register(getWebConfigClass());
|
||||
context.refresh();
|
||||
return DispatcherHandler.toHttpHandler(context);
|
||||
return WebHttpHandlerBuilder.applicationContext(context).build();
|
||||
}
|
||||
|
||||
protected URI getUrl(String path) throws URISyntaxException {
|
||||
|
||||
Reference in New Issue
Block a user