感謝您將codec-configurer屬性添加到webflux:inbound-gateway組件的指標。 回答上一個問題
這很好用。
我期待組件有類似的東西,webflux:outbound-gateway但我找不到該組件的等價物,也找不到屬性codec-configurer中使用的組件。web-client會有這樣的例子嗎?或者,也許,有沒有辦法將我的自定義添加codec-configurer到默認串列中,從而避免額外的codec-configurer?
感謝任何新的指標。
uj5u.com熱心網友回復:
該配置是WebClient您可以注入此網關的一部分。查看其構建器:
/**
* Configure the codecs for the {@code WebClient} in the
* {@link #exchangeStrategies(ExchangeStrategies) underlying}
* {@code ExchangeStrategies}.
* @param configurer the configurer to apply
* @since 5.1.13
*/
Builder codecs(Consumer<ClientCodecConfigurer> configurer);
和檔案:https ://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-client-builder
本質上,這是您需要遵循的代碼:
WebClient.builder()
.codecs(clientCodecConfigurer -> clientCodecConfigurer
.customCodecs()
.register())
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/531615.html
