From 794b86929b2da6d6bb72aaf573715a62974708c9 Mon Sep 17 00:00:00 2001 From: jhhong0509 Date: Sun, 14 Aug 2022 14:55:41 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20webClient=20codec=EC=9D=84=20SNAKE=5FCAS?= =?UTF-8?q?E=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webclient/WebClientConfiguration.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/configuration/webclient/WebClientConfiguration.kt b/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/configuration/webclient/WebClientConfiguration.kt index 52e1f94..8945498 100644 --- a/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/configuration/webclient/WebClientConfiguration.kt +++ b/user-infrastructure/src/main/kotlin/com/xquare/v1userservice/configuration/webclient/WebClientConfiguration.kt @@ -1,12 +1,23 @@ package com.xquare.v1userservice.configuration.webclient +import com.fasterxml.jackson.databind.ObjectMapper import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.http.codec.ClientCodecConfigurer +import org.springframework.http.codec.json.Jackson2JsonDecoder +import org.springframework.web.reactive.function.client.ExchangeStrategies import org.springframework.web.reactive.function.client.WebClient + @Configuration class WebClientConfiguration { @Bean - fun webClient(): WebClient = - WebClient.builder().build() + fun webClient(objectMapper: ObjectMapper): WebClient = + WebClient.builder() + .exchangeStrategies(ExchangeStrategies.builder() + .codecs { configurer: ClientCodecConfigurer -> + configurer.defaultCodecs().jackson2JsonDecoder(Jackson2JsonDecoder(objectMapper)) + } + .build()) + .build() }