Port issue fixed 97/3697/2
authorLathish <lathishbabu.ganesan@est.tech>
Thu, 14 May 2020 10:41:33 +0000 (11:41 +0100)
committerLathish <lathishbabu.ganesan@est.tech>
Thu, 14 May 2020 12:12:29 +0000 (13:12 +0100)
Issue-ID: NONRTRIC-219
Change-Id: I3cace2874f86a78be681c4ccf4322453682290ad
Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
webapp-backend/pom.xml
webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/config/TomcatWebServerConfiguration.java
webapp-backend/src/main/resources/application.properties

index 8b6599d..3ec22cb 100644 (file)
@@ -192,6 +192,24 @@ limitations under the License.
     </dependencies>
     <build>
         <plugins>
+        <plugin>
+             <groupId>org.codehaus.mojo</groupId>
+             <artifactId>build-helper-maven-plugin</artifactId>
+             <executions>
+              <execution>
+               <id>add-source</id>
+               <phase>generate-sources</phase>
+               <goals>
+                <goal>add-source</goal>
+               </goals>
+               <configuration>
+                <sources>
+                 <source>${project.build.directory}/generated-sources/annotations/</source>
+                </sources>
+               </configuration>
+              </execution>
+             </executions>
+            </plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
index 7e9f8d1..c9ef723 100644 (file)
  */
 package org.oransc.portal.nonrtric.controlpanel.config;
 
+import java.lang.invoke.MethodHandles;
 import org.apache.catalina.connector.Connector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
 import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
 import org.springframework.context.annotation.Bean;
@@ -28,17 +32,25 @@ import org.springframework.context.annotation.Configuration;
 @Configuration
 public class TomcatWebServerConfiguration {
 
+    private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+    @Value("${server.http.port}")
+    private int httpPort;
+
     @Bean
     public ServletWebServerFactory servletContainer() {
+        logger.debug("Http Port: {}", httpPort);
         TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
-        tomcat.addAdditionalTomcatConnectors(getHttpConnector());
+        if (httpPort > 0) {
+            tomcat.addAdditionalTomcatConnectors(getHttpConnector(httpPort));
+        }
         return tomcat;
     }
 
-    private static Connector getHttpConnector() {
+    private static Connector getHttpConnector(int port) {
         Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL);
         connector.setScheme("http");
-        connector.setPort(8080);
+        connector.setPort(port);
         connector.setSecure(false);
         return connector;
     }
index 267fff3..c2d5e1a 100644 (file)
 
 # A spring property but without a "spring" prefix;
 # the port number is chosen RANDOMLY when running tests
-server.port = 8434
+server.port = 8082
 server.ssl.key-store-type = PKCS12
 server.ssl.key-store-password = ericsson_kwdjfhw
 server.ssl.key-store =  classpath:keystore.jks
 server.ssl.key-password = ericsson_kwdjfhw
+server.http.port = 8080