Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Spring Webflux Codec: Can a custom codec be added the the list of default codecs globally?

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. 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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading