Browse Source

ObjectMapper.configure(MapperFeature, boolean) is deprecated as of Jackson 2.13

Closes gh-27206
pull/27208/head
Juergen Hoeller 5 years ago
parent
commit
ba08006d52
  1. 3
      spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJackson2MessageConverter.java
  2. 3
      spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java
  3. 3
      spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -92,6 +92,7 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B @@ -92,6 +92,7 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
private ClassLoader beanClassLoader;
@SuppressWarnings("deprecation") // on Jackson 2.13: configure(MapperFeature, boolean)
public MappingJackson2MessageConverter() {
this.objectMapper = new ObjectMapper();
this.objectMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false);

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -88,6 +88,7 @@ public class MappingJackson2MessageConverter extends AbstractMessageConverter { @@ -88,6 +88,7 @@ public class MappingJackson2MessageConverter extends AbstractMessageConverter {
}
@SuppressWarnings("deprecation") // on Jackson 2.13: configure(MapperFeature, boolean)
private ObjectMapper initObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false);

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -796,6 +796,7 @@ public class Jackson2ObjectMapperBuilder { @@ -796,6 +796,7 @@ public class Jackson2ObjectMapperBuilder {
module.addDeserializer((Class<T>) type, (JsonDeserializer<? extends T>) deserializer));
}
@SuppressWarnings("deprecation") // on Jackson 2.13: configure(MapperFeature, boolean)
private void configureFeature(ObjectMapper objectMapper, Object feature, boolean enabled) {
if (feature instanceof JsonParser.Feature) {
objectMapper.configure((JsonParser.Feature) feature, enabled);

Loading…
Cancel
Save