Example usage for org.springframework.http.server.reactive.bootstrap HttpServer start

List of usage examples for org.springframework.http.server.reactive.bootstrap HttpServer start

Introduction

In this page you can find the example usage for org.springframework.http.server.reactive.bootstrap HttpServer start.

Prototype

void start();

Source Link

Document

Start this component.

Usage

From source file:playground.app.Application.java

public static void main(String[] args) throws Exception {

    HttpHandler httpHandler = createHttpHandler();

    HttpServer server = new TomcatHttpServer();
    server.setPort(8080);//from w  ww  . j  ava  2  s . c  om
    server.setHandler(httpHandler);
    server.afterPropertiesSet();
    server.start();

    CompletableFuture<Void> stop = new CompletableFuture<>();
    Runtime.getRuntime().addShutdownHook(new Thread(() -> {
        stop.complete(null);
    }));
    synchronized (stop) {
        stop.wait();
    }
}