Skip to content

Commit a6e4881

Browse files
committed
Compatibility with Jackson 2.12 (tested against 2.12.0-rc1)
Closes gh-25907
1 parent 4a608e9 commit a6e4881

File tree

15 files changed

+30
-37
lines changed

15 files changed

+30
-37
lines changed

spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJackson2MessageConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
* <li>{@link DeserializationFeature#FAIL_ON_UNKNOWN_PROPERTIES} is disabled</li>
5656
* </ul>
5757
*
58-
* <p>Compatible with Jackson 2.6 and higher, as of Spring 4.3.
58+
* <p>Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
5959
*
6060
* @author Mark Pollack
6161
* @author Dave Syer

spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* <li>{@link DeserializationFeature#FAIL_ON_UNKNOWN_PROPERTIES} is disabled</li>
5353
* </ul>
5454
*
55-
* <p>Compatible with Jackson 2.9 and higher, as of Spring 5.1.
55+
* <p>Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
5656
*
5757
* @author Rossen Stoyanchev
5858
* @author Juergen Hoeller

spring-web/src/main/java/org/springframework/http/converter/cbor/MappingJackson2CborHttpMessageConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@
3737
* <p>The default constructor uses the default configuration provided by
3838
* {@link Jackson2ObjectMapperBuilder}.
3939
*
40-
* <p>Compatible with Jackson 2.9 and higher.
40+
* <p>Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
4141
*
4242
* @author Sebastien Deleuze
4343
* @since 5.0

spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* Abstract base class for Jackson based and content type independent
6262
* {@link HttpMessageConverter} implementations.
6363
*
64-
* <p>Compatible with Jackson 2.9 and higher, as of Spring 5.0.
64+
* <p>Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
6565
*
6666
* @author Arjen Poutsma
6767
* @author Keith Donald

spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
* support for Kotlin classes and data classes</li>
9393
* </ul>
9494
*
95-
* <p>Compatible with Jackson 2.6 and higher, as of Spring 4.3.
95+
* <p>Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
9696
*
9797
* @author Sebastien Deleuze
9898
* @author Juergen Hoeller
@@ -649,8 +649,8 @@ public Jackson2ObjectMapperBuilder applicationContext(ApplicationContext applica
649649
* An option to apply additional customizations directly to the
650650
* {@code ObjectMapper} instances at the end, after all other config
651651
* properties of the builder have been applied.
652-
* @param configurer a configurer to apply; if invoked multiple times, all
653-
* configurers are applied in the same order.
652+
* @param configurer a configurer to apply. If several configurers are
653+
* registered, they will get applied in their registration order.
654654
* @since 5.3
655655
*/
656656
public Jackson2ObjectMapperBuilder postConfigurer(Consumer<ObjectMapper> configurer) {

spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -135,7 +135,7 @@
135135
* &lt;/bean
136136
* </pre>
137137
*
138-
* <p>Compatible with Jackson 2.6 and higher, as of Spring 4.3.
138+
* <p>Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
139139
*
140140
* @author <a href="mailto:[email protected]">Dmitry Katsubo</a>
141141
* @author Rossen Stoyanchev

spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@
3636
*
3737
* <p>The default constructor uses the default configuration provided by {@link Jackson2ObjectMapperBuilder}.
3838
*
39-
* <p>Compatible with Jackson 2.9 and higher, as of Spring 5.0.
39+
* <p>Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
4040
*
4141
* @author Arjen Poutsma
4242
* @author Keith Donald

spring-web/src/main/java/org/springframework/http/converter/smile/MappingJackson2SmileHttpMessageConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
3535
*
3636
* <p>The default constructor uses the default configuration provided by {@link Jackson2ObjectMapperBuilder}.
3737
*
38-
* <p>Compatible with Jackson 2.9 and higher.
38+
* <p>Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
3939
*
4040
* @author Sebastien Deleuze
4141
* @since 5.0

spring-web/src/main/java/org/springframework/http/converter/xml/MappingJackson2XmlHttpMessageConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@
3737
*
3838
* <p>The default constructor uses the default configuration provided by {@link Jackson2ObjectMapperBuilder}.
3939
*
40-
* <p>Compatible with Jackson 2.9 and higher, as of Spring 5.0.
40+
* <p>Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
4141
*
4242
* @author Sebastien Deleuze
4343
* @since 4.1

spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilderTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ private static DeserializerFactoryConfig getDeserializerFactoryConfig(ObjectMapp
354354

355355
@Test
356356
void propertyNamingStrategy() {
357-
PropertyNamingStrategy strategy = new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy();
357+
PropertyNamingStrategy strategy = new PropertyNamingStrategy.SnakeCaseStrategy();
358358
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().propertyNamingStrategy(strategy).build();
359359
assertThat(objectMapper.getSerializationConfig().getPropertyNamingStrategy()).isSameAs(strategy);
360360
assertThat(objectMapper.getDeserializationConfig().getPropertyNamingStrategy()).isSameAs(strategy);
@@ -430,9 +430,8 @@ void filters() throws JsonProcessingException {
430430
assertThat(output).doesNotContain("value2");
431431
}
432432

433-
@Test // gh-23017
433+
@Test // gh-23017
434434
void postConfigurer() {
435-
436435
JacksonAnnotationIntrospector introspector1 = new JacksonAnnotationIntrospector();
437436
JacksonAnnotationIntrospector introspector2 = new JacksonAnnotationIntrospector();
438437

@@ -456,7 +455,7 @@ void completeSetup() throws JsonMappingException {
456455
JsonSerializer<Number> serializer2 = new NumberSerializer(Integer.class);
457456

458457
Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.json()
459-
.modules(new ArrayList<>()) // Disable well-known modules detection
458+
.modules(new ArrayList<>()) // Disable well-known modules detection
460459
.serializers(serializer1)
461460
.serializersByType(Collections.singletonMap(Boolean.class, serializer2))
462461
.deserializersByType(deserializerMap)
@@ -564,7 +563,6 @@ void factory() {
564563
assertThat(objectMapper.getFactory().getClass()).isEqualTo(SmileFactory.class);
565564
}
566565

567-
568566
@Test
569567
void visibility() throws JsonProcessingException {
570568
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
@@ -578,6 +576,7 @@ void visibility() throws JsonProcessingException {
578576
assertThat(json).doesNotContain("property3");
579577
}
580578

579+
581580
static class CustomIntegerModule extends Module {
582581

583582
@Override
@@ -664,6 +663,7 @@ public void setList(List<T> list) {
664663
}
665664
}
666665

666+
667667
static class JacksonVisibilityBean {
668668

669669
@SuppressWarnings("unused")
@@ -674,9 +674,9 @@ static class JacksonVisibilityBean {
674674
public String getProperty3() {
675675
return null;
676676
}
677-
678677
}
679678

679+
680680
static class OffsetDateTimeDeserializer extends JsonDeserializer<OffsetDateTime> {
681681

682682
private static final String CURRENT_ZONE_OFFSET = OffsetDateTime.now().getOffset().toString();
@@ -697,6 +697,7 @@ public OffsetDateTime deserialize(JsonParser jsonParser, DeserializationContext
697697
}
698698
}
699699

700+
700701
@JsonDeserialize
701702
static class DemoPojo {
702703

@@ -709,7 +710,6 @@ public OffsetDateTime getOffsetDateTime() {
709710
public void setOffsetDateTime(OffsetDateTime offsetDateTime) {
710711
this.offsetDateTime = offsetDateTime;
711712
}
712-
713713
}
714714

715715
@SuppressWarnings("serial")

0 commit comments

Comments
 (0)