提交 ba08006d 编写于 作者: J Juergen Hoeller

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

Closes gh-27206
上级 2594f4e0
/*
* 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);
......
/*
* 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);
......
/*
* 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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册