aboutsummaryrefslogtreecommitdiffstats
path: root/aai-resources/src
diff options
context:
space:
mode:
authorIgor Dysko <igor1.dysko@orange.com>2020-06-22 13:58:10 +0200
committerIgor Dysko <igor1.dysko@orange.com>2020-06-22 14:13:25 +0200
commit486d7f22a047b1465abc5a1365560ebf44c0e589 (patch)
tree8b708d1c4f355d6cc834fdf92d0d3612b8268cd2 /aai-resources/src
parentcc51eb3da0b3d77bc7ad7bcd61c7cdaba3031ed8 (diff)
Update to spring boot 2
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
Diffstat (limited to 'aai-resources/src')
-rw-r--r--aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java8
-rw-r--r--aai-resources/src/main/java/org/onap/aai/web/LocalHostAccessLog.java10
-rw-r--r--aai-resources/src/main/java/org/onap/aai/web/WebConfiguration.java6
-rw-r--r--aai-resources/src/main/resources/application.properties1
-rw-r--r--aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java2
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java2
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java2
7 files changed, 15 insertions, 16 deletions
diff --git a/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java b/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java
index c5f3e08..80b542b 100644
--- a/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java
+++ b/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java
@@ -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() {
diff --git a/aai-resources/src/main/java/org/onap/aai/web/LocalHostAccessLog.java b/aai-resources/src/main/java/org/onap/aai/web/LocalHostAccessLog.java
index 4bc3300..8faf828 100644
--- a/aai-resources/src/main/java/org/onap/aai/web/LocalHostAccessLog.java
+++ b/aai-resources/src/main/java/org/onap/aai/web/LocalHostAccessLog.java
@@ -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();
diff --git a/aai-resources/src/main/java/org/onap/aai/web/WebConfiguration.java b/aai-resources/src/main/java/org/onap/aai/web/WebConfiguration.java
index 5300611..a716b33 100644
--- a/aai-resources/src/main/java/org/onap/aai/web/WebConfiguration.java
+++ b/aai-resources/src/main/java/org/onap/aai/web/WebConfiguration.java
@@ -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(
diff --git a/aai-resources/src/main/resources/application.properties b/aai-resources/src/main/resources/application.properties
index d6064d5..7dee2b2 100644
--- a/aai-resources/src/main/resources/application.properties
+++ b/aai-resources/src/main/resources/application.properties
@@ -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=\
diff --git a/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java b/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java
index 09bb7a5..7a9ae2d 100644
--- a/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java
+++ b/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java
@@ -82,7 +82,7 @@ public class ResourcesTestConfiguration {
.build();
restTemplate = builder
- .requestFactory(new HttpComponentsClientHttpRequestFactory(client))
+ .requestFactory(() -> new HttpComponentsClientHttpRequestFactory(client))
.build();
}else {
restTemplate = builder.build();
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java b/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java
index ff985a9..e4684fb 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java
@@ -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;
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java
index af7d022..ee33bfc 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java
@@ -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.*;