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
* GH-1129: Add JacksonMimeTypeModule
Fixes#1129
Introduce a `JacksonMimeTypeModule` with a simple `MimeTypeSerializer`
for the proper inter-platform `MimeType` objects serialization.
Essentially we call its `toString()` which is enough to carry mime-type
info over the network.
Register this module in the `JacksonUtils.enhancedObjectMapper()` which
is used from the `DefaultKafkaHeaderMapper`.
Such a module can be registered as a bean in the application context
and will be automatically discovered by Spring Boot auto-configuration
for Jackson
* Modify a `DefaultKafkaHeaderMapper` to not deal with `MimeType`
directly any more since it is covered by the `JacksonMimeTypeModule`
even if `MimeType` is a part of collection like it is in case of
mapped HTTP headers.
* Modify `DefaultKafkaHeaderMapperTests` to check that `MimeType` is
properly serialized into its string representation even if it in the
collection
* * Add package protected ctor into `MimeTypeSerializer`
* Document a `JacksonMimeTypeModule`
* * Fix unused imports
* * Parse a `MimeType` header from its `TextNode` in the `MimeTypeJsonDeserializer`
Copy file name to clipboardExpand all lines: src/reference/asciidoc/kafka.adoc
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2450,6 +2450,8 @@ You can also extend them to implement some particular configuration logic in the
2450
2450
Starting with version 2.3, all the JSON-aware components are configured by default with a `JacksonUtils.enhancedObjectMapper()` instance, which comes with the `MapperFeature.DEFAULT_VIEW_INCLUSION` and `DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES` features disabled.
2451
2451
Also such an instance is supplied with well-known modules for custom data types, such a Java time and Kotlin support.
2452
2452
See `JacksonUtils.enhancedObjectMapper()` JavaDocs for more information.
2453
+
This method also registers a `org.springframework.kafka.support.JacksonMimeTypeModule` for `org.springframework.util.MimeType` objects serialization into the plain string for inter-platform compatibility over the network.
2454
+
A `JacksonMimeTypeModule` can be registered as a bean in the application context and it will be auto-configured into https://docs.spring.io/spring-boot/docs/current/reference/html/howto-spring-mvc.html#howto-customize-the-jackson-objectmapper[Spring Boot `ObjectMapper` instance].
2453
2455
2454
2456
Also starting with version 2.3, the `JsonDeserializer` provides `TypeReference`-based constructors for better handling of target generic container types.
0 commit comments