Update to spring boot 2 12/109412/1
authorIgor Dysko <igor1.dysko@orange.com>
Mon, 22 Jun 2020 11:58:10 +0000 (13:58 +0200)
committerIgor Dysko <igor1.dysko@orange.com>
Mon, 22 Jun 2020 12:13:25 +0000 (14:13 +0200)
Update of code and dependencies, no changes in functionality

Issue-ID: AAI-2526
Signed-off-by: Igor Dysko <igor1.dysko@orange.com>
Change-Id: I62c1a5b5e8439f1a076b0507b3834a53bc084637

aai-resources/pom.xml
aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java
aai-resources/src/main/java/org/onap/aai/web/LocalHostAccessLog.java
aai-resources/src/main/java/org/onap/aai/web/WebConfiguration.java
aai-resources/src/main/resources/application.properties
aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java
aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java
aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java
pom.xml

index d6440b8..e3141dd 100644 (file)
     </profiles>
 
     <dependencies>
+        <dependency>
+            <groupId>javax.jms</groupId>
+            <artifactId>javax.jms-api</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-core</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>net.sf.jopt-simple</groupId>
             <artifactId>jopt-simple</artifactId>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.janusgraph</groupId>
-            <artifactId>janusgraph-core</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>dom4j</groupId>
-                    <artifactId>dom4j</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.janusgraph</groupId>
-            <artifactId>janusgraph-cassandra</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>dom4j</groupId>
-                    <artifactId>dom4j</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <!--
-            indirect janusgraph-cassandra dependency
-            need to be newer than default one
-            in order to support multiple cpu archs
-        -->
         <dependency>
             <groupId>com.github.jnr</groupId>
             <artifactId>jnr-ffi</artifactId>
         </dependency>
-
-        <dependency>
-            <groupId>org.janusgraph</groupId>
-            <artifactId>janusgraph-cql</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
         <dependency>
             <groupId>com.fasterxml.jackson.jaxrs</groupId>
             <artifactId>jackson-jaxrs-json-provider</artifactId>
             <groupId>org.skyscreamer</groupId>
             <artifactId>jsonassert</artifactId>
             <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.vaadin.external.google</groupId>
+                    <artifactId>android-json</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <!--
             Explicitly stating the security spring framework and
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-jetty</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-jersey</artifactId>
-        </dependency>
         <dependency>
             <groupId>io.netty</groupId>
             <artifactId>netty-all</artifactId>
index c5f3e08..80b542b 100644 (file)
@@ -22,18 +22,16 @@ package org.onap.aai.web;
 import static java.lang.Boolean.parseBoolean;
 import static java.util.Comparator.comparingInt;
 
+import com.google.common.collect.Sets;
 import java.lang.reflect.AnnotatedElement;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.Set;
 import java.util.logging.Logger;
 import javax.annotation.Priority;
-import javax.ws.rs.client.ClientRequestFilter;
-import javax.ws.rs.client.ClientResponseFilter;
 import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.container.ContainerResponseFilter;
-import jersey.repackaged.com.google.common.collect.Sets;
-import org.glassfish.jersey.filter.LoggingFilter;
+import com.sun.jersey.api.client.filter.LoggingFilter;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.onap.aai.rest.BulkAddConsumer;
 import org.onap.aai.rest.BulkProcessConsumer;
@@ -124,7 +122,7 @@ public class JerseyConfiguration {
     }
 
     private void logRequests(ResourceConfig resourceConfig) {
-        resourceConfig.register(new LoggingFilter(log, ENABLE_RESPONSE_LOGGING));
+        resourceConfig.register(new LoggingFilter(log, ENABLE_RESPONSE_LOGGING ? null : 0));
     }
 
     private boolean isLoggingEnabled() {
index 4bc3300..8faf828 100644 (file)
@@ -24,9 +24,9 @@ import org.eclipse.jetty.server.handler.HandlerCollection;
 import org.eclipse.jetty.server.handler.RequestLogHandler;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
-import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
-import org.springframework.boot.context.embedded.jetty.JettyServerCustomizer;
+import org.springframework.boot.web.embedded.jetty.JettyServerCustomizer;
+import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
+import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -36,12 +36,12 @@ import java.util.Arrays;
 public class LocalHostAccessLog {
 
        @Bean
-       public EmbeddedServletContainerFactory jettyConfigBean(
+       public AbstractServletWebServerFactory jettyConfigBean(
             @Value("${jetty.threadPool.maxThreads:200}") final String maxThreads,
             @Value("${jetty.threadPool.minThreads:8}") final String minThreads
     ){
 
-               JettyEmbeddedServletContainerFactory jef = new JettyEmbeddedServletContainerFactory();
+    JettyServletWebServerFactory jef = new JettyServletWebServerFactory();
                jef.addServerCustomizers((JettyServerCustomizer) server -> {
 
             HandlerCollection handlers = new HandlerCollection();
index 5300611..a716b33 100644 (file)
@@ -22,14 +22,14 @@ package org.onap.aai.web;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 @Configuration
 public class WebConfiguration {
 
        @Bean
-       public WebMvcConfigurerAdapter forwardToIndex() {
-               return new WebMvcConfigurerAdapter() {
+       public WebMvcConfigurer forwardToIndex() {
+               return new WebMvcConfigurer() {
                        @Override
                        public void addViewControllers(ViewControllerRegistry registry) {
                                registry.addViewController("/swagger").setViewName(
index d6064d5..7dee2b2 100644 (file)
@@ -6,6 +6,7 @@ info.build.version=1.1.0
 
 spring.application.name=Resources Microservice
 spring.jersey.type=filter
+spring.main.allow-bean-definition-overriding=true
 
 server.contextPath=/
 spring.autoconfigure.exclude=\
index 09bb7a5..7a9ae2d 100644 (file)
@@ -82,7 +82,7 @@ public class ResourcesTestConfiguration {
                     .build();
 
             restTemplate = builder
-                    .requestFactory(new HttpComponentsClientHttpRequestFactory(client))
+                    .requestFactory(() -> new HttpComponentsClientHttpRequestFactory(client))
                     .build();
         }else {
             restTemplate = builder.build();
index ff985a9..e4684fb 100644 (file)
@@ -32,7 +32,7 @@ import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.nodes.NodeIngestor;
 import org.onap.aai.util.AAIConfig;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.web.server.LocalServerPort;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Import;
 import org.springframework.http.HttpEntity;
index af7d022..ee33bfc 100644 (file)
@@ -27,7 +27,7 @@ import org.onap.aai.ResourcesTestConfiguration;
 import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.config.SpringContextAware;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.web.server.LocalServerPort;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Import;
 import org.springframework.http.*;
diff --git a/pom.xml b/pom.xml
index d7d8e32..a9f9547 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.onap.aai.aai-common</groupId>
         <artifactId>aai-parent</artifactId>
-        <version>1.6.10</version>
+        <version>1.7.0-SNAPSHOT</version>
     </parent>
     <groupId>org.onap.aai.resources</groupId>
     <artifactId>resources</artifactId>