List of usage examples for org.springframework.web.server.adapter WebHttpHandlerBuilder applicationContext
ApplicationContext applicationContext
To view the source code for org.springframework.web.server.adapter WebHttpHandlerBuilder applicationContext.
Click Source Link
From source file:com.example.config.ApplicationBuilder.java
public static void start(ConfigurableApplicationContext context) { if (!hasListeners(context)) { ((DefaultListableBeanFactory) context.getBeanFactory()).registerDisposableBean(SHUTDOWN_LISTENER, new ShutdownApplicationListener()); new BeanCountingApplicationListener().log(context); logger.info(STARTUP);//from w w w. ja va 2s .co m } HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build(); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); HttpServer httpServer = HttpServer.create().host("localhost") .port(context.getEnvironment().getProperty("server.port", Integer.class, 8080)).handle(adapter); httpServer.bindUntilJavaShutdown(Duration.ofSeconds(60), disposable -> disposable.dispose()); }
From source file:org.springframework.cloud.gateway.test.websocket.WebSocketIntegrationTests.java
private HttpHandler createHttpHandler() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(WebSocketTestConfig.class); context.refresh();// w ww . j ava 2 s . co m return WebHttpHandlerBuilder.applicationContext(context).build(); }