Issue
I've been shown how to add custom Codecs to webflux:inbound-gateway
and webflux:outbound-gateway
declarations using respectively the codec-configurer
and web-client
attributes. href="https://stackoverflow.com/questions/74377369/how-to-add-httpmessagewriter-to-webflux-outbound-gateway/74378627#74378627">How to add HttpMessageWriter<> to webflux outbound-gateway
Is there a way (and perhaps even a simple way) of adding one's custom codec to the list of default codecs and hence avoid having to declare these in the endpoints?
Solution
See CodecConfigurerFactory
. You can use a CodecConfigurer.properties
file to specify your custom strategies for those codecs:
# 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
Answered By - Artem Bilan
Answer Checked By - Pedro (JavaFixing Volunteer)