How to customize SpringWebFlux WebClient JSON deserialization?

后端 未结 6 495
我在风中等你
我在风中等你 2020-12-06 04:15

I\'m using a spring-webflux WebClient (build 20170502.221452-172) to access a Web application producing a stream of Entry objects (application/stream+json) like th

6条回答
  •  悲哀的现实
    2020-12-06 04:47

    with webflux 5.0.2, de-registerDefaults

    val strategies = ExchangeStrategies.builder()
                    .codecs { configurer ->
                        configurer.registerDefaults(false)
                        configurer.customCodecs().encoder(Jackson2JsonEncoder(objectMapper, APPLICATION_JSON))
                        configurer.customCodecs().decoder(Jackson2JsonDecoder(objectMapper, APPLICATION_JSON))
                    }.build()
    

提交回复
热议问题