From 25bd84ec32115b346cab66eeed9dc47cd574d12b Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Tue, 7 May 2024 14:20:16 +0200 Subject: Read app version from version.properties - read app version from version.properties - make openapi dependencies compileOnly - run spotless formatter Issue-ID: PORTALNG-94 Change-Id: I3d3b9f057bc998d90763101ac8f3b32a0df280c1 Signed-off-by: Fiete Ostkamp --- .../main/java/org/onap/portalng/bff/config/BeansConfig.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/src/main') diff --git a/lib/src/main/java/org/onap/portalng/bff/config/BeansConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/BeansConfig.java index 3eb5f87..a23ac0c 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/BeansConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/BeansConfig.java @@ -33,6 +33,7 @@ import java.util.List; import lombok.extern.slf4j.Slf4j; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; import org.onap.portalng.bff.utils.Logger; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.codec.ClientCodecConfigurer; @@ -58,9 +59,11 @@ public class BeansConfig { "logRequestExchangeFilterFunction"; public static final String LOG_RESPONSE_EXCHANGE_FILTER_FUNCTION = "logResponseExchangeFilterFunction"; - private static final String CLIENT_REGISTRATION_ID = "keycloak"; public static final String X_REQUEST_ID = "X-Request-Id"; + private static final String CLIENT_REGISTRATION_ID = "keycloak"; + private static final ObjectMapper objectMapper = new ObjectMapper(); + @Bean(name = OAUTH2_EXCHANGE_FILTER_FUNCTION) ExchangeFilterFunction oauth2ExchangeFilterFunction( ReactiveOAuth2AuthorizedClientManager authorizedClientManager) { @@ -88,9 +91,8 @@ public class BeansConfig { downstreamExceptionBody -> { try { return Mono.error( - new ObjectMapper() - .readValue( - downstreamExceptionBody, DownstreamApiProblemException.class)); + objectMapper.readValue( + downstreamExceptionBody, DownstreamApiProblemException.class)); } catch (JsonProcessingException e) { return Mono.error(DownstreamApiProblemException.builder().build()); } @@ -130,7 +132,7 @@ public class BeansConfig { } @Bean - ExchangeStrategies exchangeStrategies(ObjectMapper objectMapper) { + ExchangeStrategies exchangeStrategies(@Qualifier("objectMapper") ObjectMapper objectMapper) { return ExchangeStrategies.builder() .codecs( configurer -> { -- cgit 1.2.3-korg