From 486d7f22a047b1465abc5a1365560ebf44c0e589 Mon Sep 17 00:00:00 2001 From: Igor Dysko Date: Mon, 22 Jun 2020 13:58:10 +0200 Subject: Update to spring boot 2 Update of code and dependencies, no changes in functionality Issue-ID: AAI-2526 Signed-off-by: Igor Dysko Change-Id: I62c1a5b5e8439f1a076b0507b3834a53bc084637 --- .../src/main/java/org/onap/aai/web/JerseyConfiguration.java | 8 +++----- .../src/main/java/org/onap/aai/web/LocalHostAccessLog.java | 10 +++++----- .../src/main/java/org/onap/aai/web/WebConfiguration.java | 6 +++--- 3 files changed, 11 insertions(+), 13 deletions(-) (limited to 'aai-resources/src/main/java') 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( -- cgit 1.2.3-korg