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

Closes gh-27206
This commit is contained in:
Juergen Hoeller 2021-07-23 12:19:35 +02:00
parent 2594f4e058
commit ba08006d52
3 changed files with 6 additions and 3 deletions

View File

@ -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
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);

View File

@ -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 {
}
@SuppressWarnings("deprecation") // on Jackson 2.13: configure(MapperFeature, boolean)
private ObjectMapper initObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false);

View File

@ -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 {
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);