Search in sources :

Example 1 with DispatcherHandler

use of org.springframework.web.reactive.DispatcherHandler in project spring-framework by spring-projects.

the class RouterFunctionSpec method initApplicationContext.

private ApplicationContext initApplicationContext() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.registerBean("webHandler", DispatcherHandler.class, () -> new DispatcherHandler());
    context.registerBean(HandlerMapping.class, () -> RouterFunctions.toHandlerMapping(this.routerFunction));
    context.registerBean(HandlerAdapter.class, () -> new HandlerFunctionAdapter());
    context.registerBean(HandlerResultHandler.class, () -> new ServerResponseResultHandler());
    context.refresh();
    return context;
}
Also used : HandlerFunctionAdapter(org.springframework.web.reactive.function.server.support.HandlerFunctionAdapter) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) DispatcherHandler(org.springframework.web.reactive.DispatcherHandler) ServerResponseResultHandler(org.springframework.web.reactive.function.server.support.ServerResponseResultHandler)

Example 2 with DispatcherHandler

use of org.springframework.web.reactive.DispatcherHandler in project spring-framework by spring-projects.

the class DispatcherHandlerIntegrationTests method createHttpHandler.

@Override
protected HttpHandler createHttpHandler() {
    this.wac = new AnnotationConfigApplicationContext();
    this.wac.register(TestConfiguration.class);
    this.wac.refresh();
    DispatcherHandler webHandler = new DispatcherHandler();
    webHandler.setApplicationContext(this.wac);
    return WebHttpHandlerBuilder.webHandler(webHandler).build();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) DispatcherHandler(org.springframework.web.reactive.DispatcherHandler)

Example 3 with DispatcherHandler

use of org.springframework.web.reactive.DispatcherHandler in project spring-framework by spring-projects.

the class JsonStreamingIntegrationTests method createHttpHandler.

@Override
protected HttpHandler createHttpHandler() {
    this.wac = new AnnotationConfigApplicationContext();
    this.wac.register(TestConfiguration.class);
    this.wac.refresh();
    return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(this.wac)).build();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) DispatcherHandler(org.springframework.web.reactive.DispatcherHandler)

Example 4 with DispatcherHandler

use of org.springframework.web.reactive.DispatcherHandler in project spring-framework by spring-projects.

the class SimpleUrlHandlerMappingIntegrationTests method createHttpHandler.

@Override
protected HttpHandler createHttpHandler() {
    AnnotationConfigApplicationContext wac = new AnnotationConfigApplicationContext();
    wac.register(WebConfig.class);
    wac.refresh();
    return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(wac)).exceptionHandlers(Collections.singletonList(new ResponseStatusExceptionHandler())).build();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) DispatcherHandler(org.springframework.web.reactive.DispatcherHandler) ResponseStatusExceptionHandler(org.springframework.web.server.handler.ResponseStatusExceptionHandler)

Example 5 with DispatcherHandler

use of org.springframework.web.reactive.DispatcherHandler in project spring-framework by spring-projects.

the class SseIntegrationTests method createHttpHandler.

@Override
protected HttpHandler createHttpHandler() {
    this.wac = new AnnotationConfigApplicationContext();
    this.wac.register(TestConfiguration.class);
    this.wac.refresh();
    return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(this.wac)).build();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) DispatcherHandler(org.springframework.web.reactive.DispatcherHandler)

Aggregations

AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)5 DispatcherHandler (org.springframework.web.reactive.DispatcherHandler)5 HandlerFunctionAdapter (org.springframework.web.reactive.function.server.support.HandlerFunctionAdapter)1 ServerResponseResultHandler (org.springframework.web.reactive.function.server.support.ServerResponseResultHandler)1 ResponseStatusExceptionHandler (org.springframework.web.server.handler.ResponseStatusExceptionHandler)1