6

Look as json configuration example for spring webflux client:

   ExchangeStrategies strategies = ExchangeStrategies
        .builder()
        .codecs(clientDefaultCodecsConfigurer -> {

        //how to do the same but xml?
        clientDefaultCodecsConfigurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(new ObjectMapper(), MediaType.APPLICATION_JSON));
            clientDefaultCodecsConfigurer.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(new ObjectMapper(), MediaType.APPLICATION_JSON));

        }).build();

WebClient webClient = WebClient.builder().exchangeStrategies(strategies).build();

The same question as this one but for jaxb xml serialization. Is there decoder implementation for JAXB and xml? Is it possible to use HttpMessageConverter as decoder for webclient to make spring boot controller and client implementation consistent?

Cherry
  • 31,309
  • 66
  • 224
  • 364

1 Answers1

0

My wild guess are the the Jaxb2XmlDecoder and Jaxb2XmlEncoder classes from the org.springframework.http.codec.xml package:

ExchangeStrategies.builder()
        .codecs(configurer -> {
            configurer.defaultCodecs().jaxb2Decoder(new Jaxb2XmlDecoder());
            configurer.defaultCodecs().jaxb2Encoder(new Jaxb2XmlEncoder());
        })
        .build();
Konpon96
  • 25
  • 7