Document HttpMessageConverters detection changes

This commit updates the reference documentation to better reflect
changes applied in gh-48310. As of Spring Boot 4.0.1,
`HttpMessageConverter` beans are all considered as "custom" converters
and will be set ahead of the converters list in the auto-configuration
support.

For more specific changes, developers should contribute
`ClientHttpMessageConvertersCustomizer` or
`ServerHttpMessageConvertersCustomizer` beans to better reflect their
intent: should the converter be configured for client, server or both?
How should this converter be used?

Previously, Spring Boot was relying on heuristics but they would cause
issues for server-only converters, or for specific configuration that
were not meant to replace the default converter for a given media type.

Closes gh-48574
This commit is contained in:
Brian Clozel
2025-12-18 14:56:38 +01:00
parent 2519a5d2ae
commit f61ac29f3f
3 changed files with 65 additions and 1 deletions
@@ -98,7 +98,10 @@ Any javadoc:org.springframework.http.converter.HttpMessageConverter[] bean that
You can also override default converters in the same way.
If you need to add or customize converters, you can declare one or more javadoc:org.springframework.boot.http.converter.autoconfigure.ClientHttpMessageConvertersCustomizer[] or
javadoc:org.springframework.boot.http.converter.autoconfigure.ServerHttpMessageConvertersCustomizer[] as beans, as shown in the following listing:
javadoc:org.springframework.boot.http.converter.autoconfigure.ServerHttpMessageConvertersCustomizer[] as beans. There, you can choose whether converter instances should be added
before default ones (`addCustomConverter`) or if they should override a specific default converter (like `withJsonConverter`).
See the following listing for an example:
include-code::MyHttpMessageConvertersConfiguration[]