我已经展示了如何分别使用codec-configurer
和web-client
属性向webflux:inbound-gateway
和webflux:outbound-gateway
声明添加自定义编解码器。如何添加HttpMessageWriter<>To webflux outbound-gateway
参见CodecConfigurerFactory
。您可以使用CodecConfigurer.properties
文件为这些编解码器指定自定义策略:
# Default CodecConfigurer implementation classes for static Client/ServerCodecConfigurer.create() calls.
# Not meant to be customized by application developers; simply instantiate custom impl classes instead.
org.springframework.http.codec.ClientCodecConfigurer=org.springframework.http.codec.support.DefaultClientCodecConfigurer
org.springframework.http.codec.ServerCodecConfigurer=org.springframework.http.codec.support.DefaultServerCodecConfigurer