From 5f7f21b2bbf8a6506ac2c0afa94e15f22c83d201 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Mon, 25 Mar 2019 16:23:08 -0400 Subject: Do not start 2 netty server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As webflux is enable through maven dependency, just configure the netty server provided rather than created a new one. Change-Id: I9aff7848b08b219f9f453a522fbc5608e6e5714c Issue-ID: CCSDK-1182 Signed-off-by: Alexis de Talhouët --- .../blueprintsprocessor/BlueprintHttpServer.java | 33 ++++------------------ 1 file changed, 6 insertions(+), 27 deletions(-) (limited to 'ms/blueprintsprocessor/application/src') diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.java index ae75488c1..85ccd1f43 100644 --- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.java +++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.java @@ -16,40 +16,19 @@ package org.onap.ccsdk.cds.blueprintsprocessor; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; -import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory; -import org.springframework.boot.web.server.WebServer; -import org.springframework.http.server.reactive.HttpHandler; +import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.stereotype.Component; @Component -public class BlueprintHttpServer { - - private static Logger log = LoggerFactory.getLogger(BlueprintHttpServer.class); +public class BlueprintHttpServer implements WebServerFactoryCustomizer { @Value("${blueprintsprocessor.httpPort}") private Integer httpPort; - @Autowired - HttpHandler httpHandler; - - WebServer http; - - @PostConstruct - public void start() { - ReactiveWebServerFactory factory = new NettyReactiveWebServerFactory(httpPort); - this.http = factory.getWebServer(this.httpHandler); - this.http.start(); - } - - @PreDestroy - public void stop() { - this.http.stop(); + @Override + public void customize(NettyReactiveWebServerFactory serverFactory) { + serverFactory.setPort(httpPort); } -} +} \ No newline at end of file -- cgit 1.2.3-korg