Update to spring boot 3 91/135791/1
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Tue, 22 Aug 2023 14:04:30 +0000 (16:04 +0200)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Tue, 22 Aug 2023 14:04:30 +0000 (16:04 +0200)
Issue-ID: PORTALNG-48
Change-Id: I8e8a410bd4ea399550975fc509a9d34bb2fe9c92
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
16 files changed:
app/build.gradle
build.gradle
lib/build.gradle
lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java
lib/src/main/java/org/onap/portalng/bff/config/clients/AbstractClientConfig.java
lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java
lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java
lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java
lib/src/main/java/org/onap/portalng/bff/controller/PreferencesController.java
lib/src/main/java/org/onap/portalng/bff/utils/ErrorHandler.java
lib/src/main/java/org/onap/portalng/bff/utils/Logger.java
openapi/client-portal-history/build.gradle
openapi/client-portal-keycloak/build.gradle
openapi/client-portal-prefs/build.gradle
openapi/server/build.gradle
settings.gradle

index 8faa791..7ad65cd 100644 (file)
@@ -42,10 +42,9 @@ dependencies {
     implementation 'org.springframework.boot:spring-boot-starter-security'
     implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
     implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
-    implementation "org.zalando:problem:$problemVersion"
-    implementation "org.zalando:jackson-datatype-problem:$problemVersion"
     implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml'
     implementation "org.zalando:problem-spring-webflux:$problemSpringVersion"
+    implementation "org.zalando:jackson-datatype-problem:$problemVersion"
 
     implementation "org.mapstruct:mapstruct:$mapStructVersion"
     annotationProcessor "org.mapstruct:mapstruct-processor:$mapStructVersion"
index e4eda6f..4ca21a3 100644 (file)
@@ -7,12 +7,12 @@ allprojects {
 ext {
     // app + lib
     problemVersion = '0.27.1'
-    problemSpringVersion = '0.27.0'
-    mapStructVersion = '1.5.2.Final'
-    mapStructExtensionsVersion = '0.1.2'
-    logbackVersion = '7.2'
+    problemSpringVersion = '0.29.1'
+    mapStructVersion = '1.5.5.Final'
+    mapStructExtensionsVersion = '1.0.2'
+    logbackVersion = '7.4'
     lombokVersion = '1.18.28'
 
     // app
-    wiremockVersion = '3.1.3'
+    wiremockVersion = '4.0.4'
 }
\ No newline at end of file
index 48997c3..76b1d42 100644 (file)
@@ -8,7 +8,7 @@ plugins {
     id 'com.github.spotbugs'                // bug linting that can be picked up by IDE
 }
 
-group 'org.onap.portalng'
+group 'org.onap.portal-ng'
 version rootProject.file('version').text.trim()
 
 dependencies {
@@ -23,7 +23,6 @@ dependencies {
     implementation 'org.springframework.boot:spring-boot-starter-security'
     implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
     implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
-    implementation "org.zalando:problem:$problemVersion"
     implementation "org.zalando:jackson-datatype-problem:$problemVersion"
     implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml'
     implementation "org.zalando:problem-spring-webflux:$problemSpringVersion"
index 0a78da1..7e773ed 100644 (file)
 
 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 {
index 75dce3d..8856298 100644 (file)
@@ -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<E> {
   }
 
   protected abstract DownstreamApiProblemException mapException(
-      E errorResponse, HttpStatus httpStatus);
+      E errorResponse, HttpStatusCode httpStatusCode);
 
   protected ClientHttpConnector getClientHttpConnector() {
     // ConnectionTimeouts introduced due to
index d96db71..9880ef7 100644 (file)
@@ -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<ErrorResponseKeycloakDt
 
   @Override
   protected DownstreamApiProblemException mapException(
-      ErrorResponseKeycloakDto errorResponse, HttpStatus httpStatus) {
+      ErrorResponseKeycloakDto errorResponse, HttpStatusCode httpStatusCode) {
     String errorDetail =
         errorResponse.getErrorMessage() != null
             ? errorResponse.getErrorMessage()
             : errorResponse.getError();
 
     return DownstreamApiProblemException.builder()
-        .title(httpStatus.toString())
+        .title(httpStatusCode.toString())
         .detail(errorDetail)
         .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.KEYCLOAK.toString())
         .downstreamMessageId("not set by downstream system")
-        .downstreamStatus(httpStatus.value())
+        .downstreamStatus(httpStatusCode.value())
         .build();
   }
 
index 00cda73..e6904b1 100644 (file)
@@ -38,7 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 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.web.reactive.function.client.ExchangeFilterFunction;
 import org.springframework.web.reactive.function.client.WebClient;
 
@@ -85,13 +85,13 @@ public class PortalHistoryConfig extends AbstractClientConfig<ProblemPortalHisto
 
   @Override
   protected DownstreamApiProblemException mapException(
-      ProblemPortalHistoryDto errorResponse, HttpStatus httpStatus) {
+      ProblemPortalHistoryDto errorResponse, HttpStatusCode httpStatusCode) {
     return DownstreamApiProblemException.builder()
-        .title(httpStatus.toString())
+        .title(httpStatusCode.toString())
         .detail(errorResponse.getDetail())
         .downstreamMessageId(errorResponse.getType())
         .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.PORTAL_HISTORY.toString())
-        .downstreamStatus(httpStatus.value())
+        .downstreamStatus(httpStatusCode.value())
         .build();
   }
 }
index c1aacbe..8c2eba4 100644 (file)
@@ -37,7 +37,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.web.reactive.function.client.ExchangeFilterFunction;
 import org.springframework.web.reactive.function.client.WebClient;
 
@@ -84,13 +84,13 @@ public class PortalPrefsConfig extends AbstractClientConfig<ProblemPortalPrefsDt
 
   @Override
   protected DownstreamApiProblemException mapException(
-      ProblemPortalPrefsDto errorResponse, HttpStatus httpStatus) {
+      ProblemPortalPrefsDto errorResponse, HttpStatusCode httpStatusCode) {
     return DownstreamApiProblemException.builder()
-        .title(httpStatus.toString())
+        .title(httpStatusCode.toString())
         .detail(errorResponse.getDetail())
         .downstreamMessageId(errorResponse.getType())
         .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.PORTAL_PREFS.toString())
-        .downstreamStatus(httpStatus.value())
+        .downstreamStatus(httpStatusCode.value())
         .build();
   }
 }
index c43b4c2..af665db 100644 (file)
@@ -21,7 +21,7 @@
 
 package org.onap.portalng.bff.controller;
 
-import javax.validation.Valid;
+import jakarta.validation.Valid;
 import org.onap.portalng.bff.config.BffConfig;
 import org.onap.portalng.bff.openapi.server.api.PreferencesApi;
 import org.onap.portalng.bff.openapi.server.model.CreatePreferencesRequestApiDto;
index 0b198ac..919f3b8 100644 (file)
@@ -25,7 +25,7 @@ import java.util.List;
 import java.util.Objects;
 import org.onap.portalng.bff.exceptions.DownstreamApiProblemException;
 import org.onap.portalng.bff.openapi.server.model.ProblemApiDto;
-import org.springframework.http.HttpStatus;
+import org.springframework.http.HttpStatusCode;
 
 public class ErrorHandler {
   /**
@@ -44,7 +44,7 @@ public class ErrorHandler {
   }
 
   public static DownstreamApiProblemException getDownstreamApiProblemException(
-      HttpStatus httpStatus,
+      HttpStatusCode httpStatusCode,
       List<String> 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();
   }
 }
index 3c431fb..c20cd49 100644 (file)
@@ -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) {
index 4420d80..a087be9 100644 (file)
@@ -19,7 +19,8 @@ openApiGenerate {
     configOptions = [
       openApiNullable     : "false",
       dateLibrary         : "java8",
-      serializationLibrary: "jackson"
+      serializationLibrary: "jackson",
+      useJakartaEe        : "true",
     ]
     typeMappings = [
             "File": "org.springframework.core.io.buffer.DataBuffer"
index d7984db..22da1f2 100644 (file)
@@ -19,7 +19,8 @@ openApiGenerate {
     configOptions = [
       openApiNullable     : "false",
       dateLibrary         : "java8",
-      serializationLibrary: "jackson"
+      serializationLibrary: "jackson",
+      useJakartaEe        : "true",
     ]
     typeMappings = [
             "File": "org.springframework.core.io.buffer.DataBuffer"
index 3229244..9eaa4b0 100644 (file)
@@ -19,7 +19,8 @@ openApiGenerate {
     configOptions = [
       openApiNullable     : "false",
       dateLibrary         : "java8",
-      serializationLibrary: "jackson"
+      serializationLibrary: "jackson",
+      useJakartaEe        : "true",
     ]
     typeMappings = [
             "File": "org.springframework.core.io.buffer.DataBuffer"
index 017a618..99e401b 100644 (file)
@@ -31,6 +31,7 @@ openApiGenerate {
     interfaceOnly: "true",
     useTags: "true",
     reactive: "true",
+    useSpringBoot3: "true",
   ]
   generateApiTests = false
   generateApiDocumentation = true
index 263c125..6044422 100644 (file)
@@ -3,10 +3,9 @@ pluginManagement {
     // https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_version_management
     plugins {
         id 'io.spring.dependency-management' version '1.1.2'
-        id 'org.springframework.boot' version '2.7.14'
+        id 'org.springframework.boot' version '3.1.2'
         id 'org.openapi.generator' version '7.0.0-beta'
         id 'com.github.johnrengelman.shadow' version '7.1.2'
-        id 'com.github.hierynomus.license' version '0.16.1'
         id 'com.gorylenko.gradle-git-properties' version '2.4.1'
         id 'com.diffplug.spotless' version '6.20.0'
         id 'com.github.spotbugs' version '5.0.14'