Polish and update reactive getting started reference

This commit updates the instructions on getting started with
Spring Web Reactive and also updates constructors and setters to
streamline the getting started procedure.

Issue: SPR-14640
This commit is contained in:
Rossen Stoyanchev
2016-08-30 14:36:19 -04:00
parent 436486b8a1
commit 391752abc2
8 changed files with 70 additions and 53 deletions

View File

@@ -71,6 +71,14 @@ public class DispatcherHandler implements WebHandler, ApplicationContextAware {
private List<HandlerResultHandler> resultHandlers;
public DispatcherHandler() {
}
public DispatcherHandler(ApplicationContext applicationContext) {
initStrategies(applicationContext);
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
initStrategies(applicationContext);

View File

@@ -87,8 +87,7 @@ public class DispatcherHandlerErrorTests {
appContext.register(TestConfig.class);
appContext.refresh();
this.dispatcherHandler = new DispatcherHandler();
this.dispatcherHandler.setApplicationContext(appContext);
this.dispatcherHandler = new DispatcherHandler(appContext);
this.request = new MockServerHttpRequest(HttpMethod.GET, new URI("/"));
MockServerHttpResponse response = new MockServerHttpResponse();

View File

@@ -61,10 +61,7 @@ public class SimpleUrlHandlerMappingIntegrationTests extends AbstractHttpHandler
wac.register(WebConfig.class);
wac.refresh();
DispatcherHandler dispatcherHandler = new DispatcherHandler();
dispatcherHandler.setApplicationContext(wac);
return WebHttpHandlerBuilder.webHandler(dispatcherHandler)
return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(wac))
.exceptionHandlers(new ResponseStatusExceptionHandler())
.build();
}

View File

@@ -44,9 +44,9 @@ public abstract class AbstractRequestMappingIntegrationTests extends AbstractHtt
@Override
protected HttpHandler createHttpHandler() {
this.applicationContext = initApplicationContext();
DispatcherHandler handler = new DispatcherHandler();
handler.setApplicationContext(this.applicationContext);
return WebHttpHandlerBuilder.webHandler(handler).build();
return WebHttpHandlerBuilder
.webHandler(new DispatcherHandler(this.applicationContext))
.build();
}
protected abstract ApplicationContext initApplicationContext();

View File

@@ -65,10 +65,7 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
this.wac.register(TestConfiguration.class);
this.wac.refresh();
DispatcherHandler webHandler = new DispatcherHandler();
webHandler.setApplicationContext(this.wac);
return WebHttpHandlerBuilder.webHandler(webHandler).build();
return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(this.wac)).build();
}
@Test