Commit c5787dc
authored
GH-3930: Add Jackson 3 support; deprecate Jackson 2
Fixes: #3930
This commit introduces comprehensive Jackson 3 support across the Spring for Apache Kafka framework
while maintaining backward compatibility by deprecating Jackson 2 components.
BREAKING CHANGES:
- All Jackson 2-based classes are now deprecated and will be removed in a future version
- Default Jackson version updated from 2.19.2 to 2.19.1 for Jackson 2
- Added Jackson 3 BOM dependency (3.0.0-rc5)
NEW FEATURES:
- Added complete Jackson 3 counterparts for all existing Jackson 2 classes:
* JsonKafkaHeaderMapper (replaces DefaultKafkaHeaderMapper)
* JacksonJsonSerializer/Deserializer (replaces JsonSerializer/Deserializer)
* JacksonJsonSerde (replaces JsonSerde)
* JacksonJsonMessageConverter and subclasses (replaces JsonMessageConverter family)
* JacksonProjectingMessageConverter (replaces ProjectingMessageConverter)
* DefaultJacksonJavaTypeMapper (replaces DefaultJackson2JavaTypeMapper)
* Jackson3Utils and Jackson3MimeTypeModule utilities
INFRASTRUCTURE:
- Enhanced JacksonPresent utility to detect Jackson 3 availability
- Updated MessagingMessageConverter and BatchMessagingMessageConverter to prefer Jackson 3
- Modified RecordMessagingMessageListenerAdapter to handle new converter types
- Updated all serialization/deserialization logic to use Jackson 3 APIs
DOCUMENTATION:
- Updated all documentation references from Jackson 2 to Jackson 3 classes
- Corrected sample code and configuration examples
- Updated method signatures and class references throughout documentation
TESTING:
- Migrated all test cases to use Jackson 3 equivalents
- Updated test configurations and mock setups
- Maintained test coverage for both Jackson 2 (deprecated) and Jackson 3 paths
The framework now automatically detects and prefers Jackson 3 when available, falling back to Jackson 2 for backward compatibility.
All existing applications will continue to work with Jackson 2, but new development should migrate to Jackson 3 classes.
* Refine Jackson 3 implementation naming and API consistency
This commit refines the Jackson 3 implementation introduced in the previous
commit to improve API consistency and naming conventions.
CHANGES:
- Rename Jackson3Utils to JacksonMapperUtils for better naming consistency
- Rename Jackson3MimeTypeModule to MimeTypeJacksonModule to follow Spring conventions
- Update all Jackson 3 classes to use JsonMapper instead of ObjectMapper for type safety
- Restore Jackson 2 BOM version from 2.19.1 to 2.19.2
- Prioritize Jackson 3 over Jackson 2 in MessagingMessageConverter detection
- Add a section in whats-new for Jackson 3 changes
TECHNICAL IMPROVEMENTS:
- Enhanced type safety by using JsonMapper (Jackson 3) instead of generic ObjectMapper
- Consistent naming patterns across all Jackson 3 components
- Updated method names: getObjectMapper() → getJsonMapper()
- Updated parameter names: objectMapper → jsonMapper throughout codebase
- Updated factory method: enhancedObjectMapper() → jsonMapper()
API CHANGES:
- All Jackson 3 constructors now accept JsonMapper instead of ObjectMapper
- JsonKafkaHeaderMapper uses JsonMapper for better type consistency
- JacksonProjectingMessageConverter updated to use JsonMapper API
- All serializer/deserializer classes consistently use JsonMapper
DEPRECATION UPDATES:
- Updated deprecation messages to reference correct replacement classes
- Added missing @deprecated annotation to JacksonMimeTypeModule
This refinement aligns with Spring Framework's approach to Jackson 3 integration
and ensures a clean, consistent API surface for the new Jackson 3 support.
Related: spring-projects/spring-framework#35282
* Restore enhancedJsonMapper method name
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>1 parent 122d8ce commit c5787dc
File tree
65 files changed
+3330
-212
lines changed- samples
- sample-01
- sample-02
- spring-kafka-docs/src/main
- antora/modules/ROOT/pages
- appendix
- kafka
- receiving-messages
- java/org/springframework/kafka/jdocs/requestreply
- kotlin/org/springframework/kafka/kdocs/requestreply
- spring-kafka/src
- main/java/org/springframework/kafka
- listener/adapter
- support
- converter
- mapping
- serializer
- test
- java/org/springframework/kafka
- annotation
- listener
- adapter
- requestreply
- streams
- support
- converter
- serializer
- kotlin/org/springframework/kafka/listener
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
65 files changed
+3330
-212
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
| |||
263 | 265 | | |
264 | 266 | | |
265 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
266 | 274 | | |
267 | 275 | | |
268 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1083 | 1083 | | |
1084 | 1084 | | |
1085 | 1085 | | |
1086 | | - | |
| 1086 | + | |
1087 | 1087 | | |
1088 | 1088 | | |
1089 | 1089 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
566 | | - | |
| 566 | + | |
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
| |||
Lines changed: 16 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
541 | | - | |
| 541 | + | |
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
| |||
0 commit comments