From 7348ffad6bb027b2e815b2081a9d9a827a84836e Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Tue, 22 Aug 2023 16:04:30 +0200 Subject: Update to spring boot 3 Issue-ID: PORTALNG-48 Change-Id: I8e8a410bd4ea399550975fc509a9d34bb2fe9c92 Signed-off-by: Fiete Ostkamp --- lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java | 8 +++----- .../onap/portalng/bff/config/clients/AbstractClientConfig.java | 4 ++-- .../java/org/onap/portalng/bff/config/clients/KeycloakConfig.java | 8 ++++---- .../org/onap/portalng/bff/config/clients/PortalHistoryConfig.java | 8 ++++---- .../org/onap/portalng/bff/config/clients/PortalPrefsConfig.java | 8 ++++---- .../org/onap/portalng/bff/controller/PreferencesController.java | 2 +- lib/src/main/java/org/onap/portalng/bff/utils/ErrorHandler.java | 8 ++++---- lib/src/main/java/org/onap/portalng/bff/utils/Logger.java | 6 +++--- 8 files changed, 25 insertions(+), 27 deletions(-) (limited to 'lib/src/main') diff --git a/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java index 0a78da1..7e773ed 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java @@ -21,14 +21,13 @@ package org.onap.portalng.bff.config; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import java.util.List; import java.util.Map; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.ConstructorBinding; import org.zalando.problem.Problem; import org.zalando.problem.Status; import reactor.core.publisher.Mono; @@ -38,7 +37,6 @@ import reactor.core.publisher.Mono; * urls. */ @Valid -@ConstructorBinding @ConfigurationProperties("bff") @Data public class BffConfig { diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/AbstractClientConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/AbstractClientConfig.java index 75dce3d..8856298 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/AbstractClientConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/AbstractClientConfig.java @@ -26,7 +26,7 @@ import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.http.client.reactive.ClientHttpConnector; import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.web.reactive.function.client.ExchangeFilterFunction; @@ -56,7 +56,7 @@ public abstract class AbstractClientConfig { } protected abstract DownstreamApiProblemException mapException( - E errorResponse, HttpStatus httpStatus); + E errorResponse, HttpStatusCode httpStatusCode); protected ClientHttpConnector getClientHttpConnector() { // ConnectionTimeouts introduced due to diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java index d96db71..9880ef7 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java @@ -34,7 +34,7 @@ import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.http.client.reactive.ClientHttpConnector; import org.springframework.web.reactive.function.client.ExchangeFilterFunction; import org.springframework.web.reactive.function.client.WebClient; @@ -78,18 +78,18 @@ public class KeycloakConfig extends AbstractClientConfig variables, String text, String messageId, @@ -55,11 +55,11 @@ public class ErrorHandler { : null; return DownstreamApiProblemException.builder() - .title(httpStatus.toString()) + .title(httpStatusCode.toString()) .detail(errorDetail) .downstreamMessageId(Objects.requireNonNullElse(messageId, "not set by downstream system")) .downstreamSystem(downStreamSystem.toString()) - .downstreamStatus(httpStatus.value()) + .downstreamStatus(httpStatusCode.value()) .build(); } } diff --git a/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java b/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java index 3c431fb..c20cd49 100644 --- a/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java +++ b/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java @@ -24,7 +24,7 @@ package org.onap.portalng.bff.utils; import java.net.URI; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; @Slf4j public class Logger { @@ -39,8 +39,8 @@ public class Logger { log.info("bff - request - X-Request-Id {} {} {}", xRequestId, methode, path); } - public static void responseLog(String xRequestId, HttpStatus code) { - log.info("bff - response - X-Request-Id {} {}", xRequestId, code); + public static void responseLog(String xRequestId, HttpStatusCode httpStatusCode) { + log.info("bff - response - X-Request-Id {} {}", xRequestId, httpStatusCode); } public static void errorLog(String xRequestId, String msg, String id, String app) { -- cgit 1.2.3-korg