Skip to content

Commit be1a169

Browse files
committed
GH-3088: Add Jackson 3 support; deprecate Jackson 2
Fixes: #3088 * Manage `tools.jackson` dependencies, similar way we do for Jackson 2 * Add Jackson 3 counterparts for existing Jackson 2 based classes. Technically, that is mostly just a copy/paste of existing classes, but with `tools.jackson` API adjustments * Fix `AbstractJacksonMessageConverter` to catch not only `IOException`, but also `JacksonException` * Migrate tests and docs to use new classes * Deprecate Jackson 2 based classes
1 parent 688fd00 commit be1a169

33 files changed

+1437
-245
lines changed

build.gradle

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ ext {
4040
hamcrestVersion = '3.0'
4141
hibernateValidationVersion = '8.0.2.Final'
4242
jacksonBomVersion = '2.19.1'
43+
jackson3Version = '3.0.0-rc5'
4344
jaywayJsonPathVersion = '2.9.0'
4445
junitJupiterVersion = '5.13.2'
4546
kotlinCoroutinesVersion = '1.10.2'
@@ -110,6 +111,7 @@ allprojects {
110111

111112
imports {
112113
mavenBom "com.fasterxml.jackson:jackson-bom:$jacksonBomVersion"
114+
mavenBom "tools.jackson:jackson-bom:$jackson3Version"
113115
mavenBom "org.junit:junit-bom:$junitJupiterVersion"
114116
mavenBom "org.springframework:spring-framework-bom:$springVersion"
115117
mavenBom "io.projectreactor:reactor-bom:$reactorVersion"
@@ -306,6 +308,7 @@ project('spring-amqp') {
306308
optionalApi 'org.springframework:spring-messaging'
307309
optionalApi 'org.springframework:spring-oxm'
308310
optionalApi 'org.springframework:spring-context'
311+
309312
optionalApi 'com.fasterxml.jackson.core:jackson-core'
310313
optionalApi 'com.fasterxml.jackson.core:jackson-databind'
311314
optionalApi 'com.fasterxml.jackson.core:jackson-annotations'
@@ -315,6 +318,14 @@ project('spring-amqp') {
315318
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
316319
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-joda'
317320
optionalApi 'com.fasterxml.jackson.module:jackson-module-kotlin'
321+
322+
optionalApi 'tools.jackson.core:jackson-databind'
323+
optionalApi 'tools.jackson.datatype:jackson-datatype-joda'
324+
optionalApi 'tools.jackson.dataformat:jackson-dataformat-xml'
325+
optionalApi('tools.jackson.module:jackson-module-kotlin') {
326+
exclude group: 'org.jetbrains.kotlin'
327+
}
328+
318329
// Spring Data projection message binding support
319330
optionalApi 'org.springframework.data:spring-data-commons'
320331
optionalApi "com.jayway.jsonpath:json-path:$jaywayJsonPathVersion"
@@ -389,6 +400,9 @@ project('spring-rabbit') {
389400
testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind'
390401
testRuntimeOnly 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml'
391402
testRuntimeOnly 'com.fasterxml.jackson.module:jackson-module-kotlin'
403+
404+
testRuntimeOnly 'tools.jackson.core:jackson-databind'
405+
testRuntimeOnly 'tools.jackson.dataformat:jackson-dataformat-xml'
392406
}
393407
}
394408

@@ -407,6 +421,8 @@ project('spring-rabbit-stream') {
407421
testRuntimeOnly 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml'
408422
testRuntimeOnly 'com.fasterxml.jackson.module:jackson-module-kotlin'
409423

424+
testRuntimeOnly 'tools.jackson.core:jackson-databind'
425+
410426
testImplementation 'org.testcontainers:rabbitmq'
411427
testImplementation 'org.testcontainers:junit-jupiter'
412428
testImplementation 'org.apache.logging.log4j:log4j-slf4j-impl'
@@ -430,6 +446,8 @@ project('spring-rabbitmq-client') {
430446

431447
testRuntimeOnly 'com.fasterxml.jackson.core:jackson-databind'
432448

449+
testRuntimeOnly 'tools.jackson.core:jackson-databind'
450+
433451
testImplementation 'org.testcontainers:rabbitmq'
434452
testImplementation 'org.testcontainers:junit-jupiter'
435453
testImplementation 'org.apache.logging.log4j:log4j-slf4j-impl'

spring-amqp/src/main/java/org/springframework/amqp/support/converter/AbstractJackson2MessageConverter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@
5151
* @author Gary Russell
5252
*
5353
* @since 2.1
54+
*
55+
* @deprecated since 4.0 in favor of {@link AbstractJacksonMessageConverter} for Jackson 3.
5456
*/
57+
@Deprecated(forRemoval = true, since = "4.0")
5558
public abstract class AbstractJackson2MessageConverter extends AbstractMessageConverter
5659
implements BeanClassLoaderAware, SmartMessageConverter {
5760

0 commit comments

Comments
 (0)