Skip to content

Commit 1d91757

Browse files
committed
Document that HttpMessageConverters can be used for reordering/removal
Closes gh-40767
1 parent f5262d8 commit 1d91757

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,8 @@
20692069
{
20702070
"name": "spring.mvc.converters.preferred-json-mapper",
20712071
"type": "java.lang.String",
2072-
"description": "Preferred JSON mapper to use for HTTP message conversion. By default, auto-detected according to the environment."
2072+
"defaultValue": "jackson",
2073+
"description": "Preferred JSON mapper to use for HTTP message conversion. By default, auto-detected according to the environment. Supported values are 'jackson', 'gson', and 'jsonb'. When other json mapping libraries (such as kotlinx.serialization) are present, use a custom HttpMessageConverters bean to control the preferred mapper."
20732074
},
20742075
{
20752076
"name": "spring.mvc.date-format",

spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc

+5-2
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,15 @@ Sensible defaults are included out of the box.
8686
For example, objects can be automatically converted to JSON (by using the Jackson library) or XML (by using the Jackson XML extension, if available, or by using JAXB if the Jackson XML extension is not available).
8787
By default, strings are encoded in `UTF-8`.
8888

89+
Any `HttpMessageConverter` bean that is present in the context is added to the list of converters.
90+
You can also override default converters in the same way.
91+
8992
If you need to add or customize converters, you can use Spring Boot's `HttpMessageConverters` class, as shown in the following listing:
9093

9194
include::code:MyHttpMessageConvertersConfiguration[]
9295

93-
Any `HttpMessageConverter` bean that is present in the context is added to the list of converters.
94-
You can also override default converters in the same way.
96+
For further control, you can also sub-class `HttpMessageConverters` and override its `postProcessConverters` and/or `postProcessPartConverters` methods.
97+
This can be useful when you want to re-order or remove some of the converters that Spring MVC configures by default.
9598

9699

97100

0 commit comments

Comments
 (0)