Custom WebFlux encoders/decoders are placed below defaults #22612
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
When registering custom encoders and decoders to handle media types (e.g.
application/hal+json
) inside https://github.com/spring-projects/spring-hateoas/blob/master/src/main/java/org/springframework/hateoas/config/WebClientConfigurer.java, they are placed too far down to get read.The default decoders includes a
DecoderHttpMessageReader
with mime typesapplication/json
andapplication/*+json
.application/json
is okay, because that is quite specific. However, putting a pattern matcher forapplication/*+json
ahead ofapplication/hal+json
causes the default one to always get selected. And this will happen for any other media type that registers a JSON-based media type (e.g. HAL-FORMS atapplication/prs.hal-forms+json
).I don't know if this means custom encoders and decoders should be moved to the front, or if something more sophisticated is needed, like putting wildcard-based patterns after non-wildcard-based ones.
For now, it forces us to disable the default registry just to get operational, which in turn causes headache for downstream projects like Spring Cloud Sleuth that are having their own
WebClient
post processing trounced by Spring HATEAOS.The text was updated successfully, but these errors were encountered: