You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Revisit converters and codecs default setup in HTTP stacks #33894
The order of codecs has been the same for a very long time and applications might rely on it.
On the other hand, Spring Boot has been consistently reordering converters and codecs to align with industry trends. For example, reordering XML last in favor of JSON and other converters.
Unfortunately, this creates a disconnect between the order as declared in the application context and what Spring Boot applies in practice. This also causes inconsistencies like spring-projects/spring-boot#43143.
We should consider a change here, as long as there is minimal disruption for Framework and Boot developers.
changed the title [-]Consider reordering converters and codecs in HTTP stacks [/-][+]Consider revisiting converters and codecs default setup in HTTP stacks [/+]on Apr 2, 2025
changed the title [-]Consider revisiting converters and codecs default setup in HTTP stacks [/-][+]Revisit converters and codecs default setup in HTTP stacks [/+]on Jul 17, 2025
@Ixiodor I don't understand. Can you elaborate? Did you upgrade an application to a 7.0 milestone and see a behavior change? Maybe you can share a minimal sample application that demonstrates one behavior with 6.x and another with 7.0?
Because the XML converter is listed before JSON, the default behavior ends up preferring XML over JSON when the request does not explicitly specify an Accept header.
This causes some unexpected behavior, for example:
Default error pages are returned in XML
@ControllerAdvice responses are serialized as XML
RestTemplate post uses XML instead of JSON by default
Activity
[-]Consider reordering converters and codecs in HTTP stacks [/-][+]Consider revisiting converters and codecs default setup in HTTP stacks [/+]Add HttpMessageConverters
Adapt to HttpMessageConverters changes in Framework
Use HttpMessageConverters in client and server config
1 remaining item
Make HttpMessageConverters classpath detection static
Reorder multipart converter for server converters
Revert temporary workaround for HttpMessageConverters
Simplify media files detection in WebMvcConfigurationSupport
Simplify media files detection in WebMvcConfigurationSupport
Align HttpMessageConverters builder with WebFlux codecs variants
Refine multipart converter registration in HttpMessageConverters
[-]Consider revisiting converters and codecs default setup in HTTP stacks [/-][+]Revisit converters and codecs default setup in HTTP stacks [/+]Ixiodor commentedon Sep 11, 2025
How can I fix this behavior? Right now, RestTemplate uses XML by default, and the same happens with @ControllerAdvice.
bclozel commentedon Sep 11, 2025
@Ixiodor I don't understand. Can you elaborate? Did you upgrade an application to a 7.0 milestone and see a behavior change? Maybe you can share a minimal sample application that demonstrates one behavior with 6.x and another with 7.0?
Ixiodor commentedon Sep 11, 2025
Hi,
I'm on:
When I check the registered message converters, I see:
Because the XML converter is listed before JSON, the default behavior ends up preferring XML over JSON when the request does not explicitly specify an Accept header.
This causes some unexpected behavior, for example:
(Coming from 3.2.2)
bclozel commentedon Sep 11, 2025
@Ixiodor In this case it's completely unrelated to this issue. You can ask this question on StackOverflow and share here the link, I will have a look.
Ixiodor commentedon Sep 11, 2025
https://stackoverflow.com/questions/79762083/spring-changed-converters-order-prefering-xml Thanks