Deprecate for removal Jackson 2 support
This commit deprecate for removal (likely in a future 7.x release) the Jackson 2 support in favor of the Jackson 3 one. Closes gh-33798
This commit is contained in:
@@ -25,6 +25,7 @@ import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
|
||||
import org.springframework.test.web.servlet.assertj.MockMvcTester;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
// tag::snippet[]
|
||||
@SpringJUnitWebConfig(ApplicationWebConfiguration.class)
|
||||
class AccountControllerIntegrationTests {
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
|
||||
import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
// tag::snippet[]
|
||||
@Configuration
|
||||
public class WebConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
||||
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
// tag::snippet[]
|
||||
@Configuration
|
||||
public class FreeMarkerConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
// tag::snippet[]
|
||||
@Configuration
|
||||
public class WebConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 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.
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.springframework.docs.testing.mockmvc.assertj.mockmvctestersetup.converter
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.springframework.docs.web.webmvc.mvcconfig.mvcconfigmessageconverters
|
||||
|
||||
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.springframework.docs.web.webmvc.mvcconfig.mvcconfigviewresolvers
|
||||
|
||||
import org.springframework.context.annotation.Bean
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.springframework.docs.web.webmvc.mvcconfig.mvcconfigviewresolvers
|
||||
|
||||
import org.springframework.context.annotation.Configuration
|
||||
|
||||
@@ -60,7 +60,9 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Juergen Hoeller
|
||||
* @author Stephane Nicoll
|
||||
* @since 3.1.4
|
||||
* @deprecated since 7.0 in favor of {@link JacksonJsonMessageConverter}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
public class MappingJackson2MessageConverter implements SmartMessageConverter, BeanClassLoaderAware {
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,9 @@ import org.springframework.util.MimeType;
|
||||
* @author Juergen Hoeller
|
||||
* @author Sebastien Deleuze
|
||||
* @since 4.0
|
||||
* @deprecated since 7.0 in favor of {@link JacksonJsonMessageConverter}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
public class MappingJackson2MessageConverter extends AbstractMessageConverter {
|
||||
|
||||
private static final MimeType[] DEFAULT_MIME_TYPES = new MimeType[] {
|
||||
|
||||
@@ -535,6 +535,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
|
||||
/**
|
||||
* Allow to customize Jackson 2.x JSON converter.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected MappingJackson2MessageConverter createJacksonConverter() {
|
||||
DefaultContentTypeResolver resolver = new DefaultContentTypeResolver();
|
||||
resolver.setDefaultMimeType(MimeTypeUtils.APPLICATION_JSON);
|
||||
|
||||
@@ -43,6 +43,7 @@ import static org.assertj.core.api.Assertions.within;
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class MappingJackson2MessageConverterTests {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
* @see AbstractJackson2Encoder
|
||||
*/
|
||||
@BenchmarkMode(Mode.Throughput)
|
||||
@SuppressWarnings("removal")
|
||||
public class Jackson2JsonEncoderBenchmark {
|
||||
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ public abstract class AbstractJacksonEncoder extends JacksonCodecSupport impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public boolean canEncode(ResolvableType elementType, @Nullable MimeType mimeType) {
|
||||
if (!supportsMimeType(mimeType)) {
|
||||
return false;
|
||||
|
||||
@@ -40,7 +40,10 @@ import org.springframework.util.MimeType;
|
||||
* @since 5.2
|
||||
* @see Jackson2CborEncoder
|
||||
* @see <a href="https://github.com/spring-projects/spring-framework/issues/20513">Add CBOR support to WebFlux</a>
|
||||
* @deprecated since 7.0 in favor of {@link JacksonCborDecoder}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class Jackson2CborDecoder extends AbstractJackson2Decoder {
|
||||
|
||||
public Jackson2CborDecoder() {
|
||||
|
||||
@@ -41,7 +41,10 @@ import org.springframework.util.MimeType;
|
||||
* @since 5.2
|
||||
* @see Jackson2CborDecoder
|
||||
* @see <a href="https://github.com/spring-projects/spring-framework/issues/20513">Add CBOR support to WebFlux</a>
|
||||
* @deprecated since 7.0 in favor of {@link JacksonCborEncoder}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class Jackson2CborEncoder extends AbstractJackson2Encoder {
|
||||
|
||||
public Jackson2CborEncoder() {
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.springframework.core.io.buffer.DataBufferLimitException;
|
||||
import org.springframework.core.io.buffer.DataBufferUtils;
|
||||
import org.springframework.core.io.buffer.PooledDataBuffer;
|
||||
import org.springframework.core.log.LogFormatUtils;
|
||||
import org.springframework.http.codec.AbstractJacksonDecoder;
|
||||
import org.springframework.http.codec.HttpMessageDecoder;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
@@ -61,7 +62,10 @@ import org.springframework.util.MimeType;
|
||||
* @author Arjen Poutsma
|
||||
* @since 5.0
|
||||
* @see <a href="https://github.com/FasterXML/jackson-core/issues/57" target="_blank">Add support for non-blocking ("async") JSON parsing</a>
|
||||
* @deprecated since 7.0 in favor of {@link AbstractJacksonDecoder}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public abstract class AbstractJackson2Decoder extends Jackson2CodecSupport implements HttpMessageDecoder<Object> {
|
||||
|
||||
private int maxInMemorySize = 256 * 1024;
|
||||
|
||||
@@ -50,6 +50,7 @@ import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DataBufferFactory;
|
||||
import org.springframework.core.log.LogFormatUtils;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.codec.AbstractJacksonEncoder;
|
||||
import org.springframework.http.codec.HttpMessageEncoder;
|
||||
import org.springframework.http.converter.json.MappingJacksonValue;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
@@ -66,7 +67,10 @@ import org.springframework.util.MimeType;
|
||||
* @author Sebastien Deleuze
|
||||
* @author Arjen Poutsma
|
||||
* @since 5.0
|
||||
* @deprecated since 7.0 in favor of {@link AbstractJacksonEncoder}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public abstract class AbstractJackson2Encoder extends Jackson2CodecSupport implements HttpMessageEncoder<Object> {
|
||||
|
||||
private static final byte[] NEWLINE_SEPARATOR = {'\n'};
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.core.codec.Hints;
|
||||
import org.springframework.http.HttpLogging;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ProblemDetail;
|
||||
import org.springframework.http.codec.JacksonCodecSupport;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -53,7 +54,9 @@ import org.springframework.util.ObjectUtils;
|
||||
* @author Sebastien Deleuze
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
* @deprecated since 7.0 in favor of {@link JacksonCodecSupport}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
public abstract class Jackson2CodecSupport {
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.codec.CharBufferDecoder;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
||||
import org.springframework.http.codec.AbstractJacksonDecoder;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.util.MimeType;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
@@ -43,7 +44,10 @@ import org.springframework.util.MimeTypeUtils;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
* @see Jackson2JsonEncoder
|
||||
* @deprecated since 7.0 in favor of {@link AbstractJacksonDecoder}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class Jackson2JsonDecoder extends AbstractJackson2Decoder {
|
||||
|
||||
private static final CharBufferDecoder CHAR_BUFFER_DECODER = CharBufferDecoder.textPlainOnly(Arrays.asList(",", "\n"), false);
|
||||
|
||||
@@ -44,7 +44,10 @@ import org.springframework.util.MimeType;
|
||||
* @author Arjen Poutsma
|
||||
* @since 5.0
|
||||
* @see Jackson2JsonDecoder
|
||||
* @deprecated since 7.0 in favor of {@link JacksonJsonEncoder}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class Jackson2JsonEncoder extends AbstractJackson2Encoder {
|
||||
|
||||
private static final List<MimeType> problemDetailMimeTypes =
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.http.codec.json;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
|
||||
|
||||
import org.springframework.http.codec.smile.JacksonSmileDecoder;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MimeType;
|
||||
@@ -31,7 +32,10 @@ import org.springframework.util.MimeType;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
* @see Jackson2JsonEncoder
|
||||
* @deprecated since 7.0 in favor of {@link JacksonSmileDecoder}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class Jackson2SmileDecoder extends AbstractJackson2Decoder {
|
||||
|
||||
private static final MimeType[] DEFAULT_SMILE_MIME_TYPES = new MimeType[] {
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.jspecify.annotations.Nullable;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.codec.smile.JacksonSmileEncoder;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MimeType;
|
||||
@@ -37,7 +38,10 @@ import org.springframework.util.MimeType;
|
||||
* @author Sebastien Deleuze
|
||||
* @since 5.0
|
||||
* @see Jackson2SmileDecoder
|
||||
* @deprecated since 7.0 in favor of {@link JacksonSmileEncoder}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class Jackson2SmileEncoder extends AbstractJackson2Encoder {
|
||||
|
||||
private static final MimeType[] DEFAULT_SMILE_MIME_TYPES = new MimeType[] {
|
||||
|
||||
@@ -50,7 +50,9 @@ import org.springframework.core.io.buffer.DataBufferUtils;
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Juergen Hoeller
|
||||
* @since 5.0
|
||||
* @deprecated since 7.0 in favor of {@code org.springframework.http.codec.JacksonTokenizer}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
final class Jackson2Tokenizer {
|
||||
|
||||
private final JsonParser parser;
|
||||
|
||||
@@ -486,6 +486,7 @@ class BaseDefaultCodecs implements CodecConfigurer.DefaultCodecs, CodecConfigure
|
||||
* if configured by the application, to the given codec , including any
|
||||
* codec it contains.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private void initCodec(@Nullable Object codec) {
|
||||
if (codec instanceof DecoderHttpMessageReader<?> decoderHttpMessageReader) {
|
||||
codec = decoderHttpMessageReader.getDecoder();
|
||||
@@ -612,6 +613,7 @@ class BaseDefaultCodecs implements CodecConfigurer.DefaultCodecs, CodecConfigure
|
||||
* Reset and initialize object readers.
|
||||
* @since 5.3.3
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected void initObjectReaders() {
|
||||
this.objectReaders.clear();
|
||||
if (!this.registerDefaults) {
|
||||
@@ -760,6 +762,7 @@ class BaseDefaultCodecs implements CodecConfigurer.DefaultCodecs, CodecConfigure
|
||||
/**
|
||||
* Return "base" object writers only, i.e. common to client and server.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
final List<HttpMessageWriter<?>> getBaseObjectWriters() {
|
||||
List<HttpMessageWriter<?>> writers = new ArrayList<>();
|
||||
if (kotlinSerializationCborPresent) {
|
||||
@@ -839,6 +842,7 @@ class BaseDefaultCodecs implements CodecConfigurer.DefaultCodecs, CodecConfigure
|
||||
return this.jacksonJsonDecoder;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
protected Decoder<?> getJackson2JsonDecoder() {
|
||||
if (this.jackson2JsonDecoder == null) {
|
||||
this.jackson2JsonDecoder = new Jackson2JsonDecoder();
|
||||
@@ -853,6 +857,7 @@ class BaseDefaultCodecs implements CodecConfigurer.DefaultCodecs, CodecConfigure
|
||||
return this.jacksonJsonEncoder;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
protected Encoder<?> getJackson2JsonEncoder() {
|
||||
if (this.jackson2JsonEncoder == null) {
|
||||
this.jackson2JsonEncoder = new Jackson2JsonEncoder();
|
||||
|
||||
@@ -271,6 +271,7 @@ public abstract class AbstractJacksonHttpMessageConverter extends AbstractSmartH
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public boolean canWrite(Class<?> clazz, @Nullable MediaType mediaType) {
|
||||
if (!canWrite(mediaType)) {
|
||||
return false;
|
||||
@@ -328,6 +329,7 @@ public abstract class AbstractJacksonHttpMessageConverter extends AbstractSmartH
|
||||
return readJavaType(javaType, inputMessage, null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private Object readJavaType(JavaType javaType, HttpInputMessage inputMessage, @Nullable Map<String, Object> hints) throws IOException {
|
||||
MediaType contentType = inputMessage.getHeaders().getContentType();
|
||||
Charset charset = getCharset(contentType);
|
||||
|
||||
@@ -39,7 +39,10 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
* @since 5.0
|
||||
* @deprecated since 7.0 in favor of {@link JacksonCborHttpMessageConverter}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class MappingJackson2CborHttpMessageConverter extends AbstractJackson2HttpMessageConverter {
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,6 +57,7 @@ import org.springframework.http.HttpOutputMessage;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ProblemDetail;
|
||||
import org.springframework.http.converter.AbstractGenericHttpMessageConverter;
|
||||
import org.springframework.http.converter.AbstractJacksonHttpMessageConverter;
|
||||
import org.springframework.http.converter.HttpMessageConversionException;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
@@ -78,7 +79,10 @@ import org.springframework.util.TypeUtils;
|
||||
* @author Sam Brannen
|
||||
* @since 4.1
|
||||
* @see MappingJackson2HttpMessageConverter
|
||||
* @deprecated since 7.0 in favor of {@link AbstractJacksonHttpMessageConverter}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public abstract class AbstractJackson2HttpMessageConverter extends AbstractGenericHttpMessageConverter<Object> {
|
||||
|
||||
private static final Map<String, JsonEncoding> ENCODINGS;
|
||||
|
||||
@@ -100,8 +100,10 @@ import org.springframework.util.xml.StaxUtils;
|
||||
* @since 4.1.1
|
||||
* @see #build()
|
||||
* @see #configure(ObjectMapper)
|
||||
* @see Jackson2ObjectMapperFactoryBean
|
||||
* @deprecated since 7.0 in favor using directly Jackson 3 builders like {@link tools.jackson.databind.json.JsonMapper#builder}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class Jackson2ObjectMapperBuilder {
|
||||
|
||||
private static final boolean jackson2XmlPresent = ClassUtils.isPresent(
|
||||
|
||||
@@ -136,7 +136,10 @@ import org.springframework.context.ApplicationContextAware;
|
||||
* @author Tadaya Tsuyukubo
|
||||
* @author Sebastien Deleuze
|
||||
* @since 3.2
|
||||
* @deprecated since 7.0 in favor of using directly Jackson 3 converters default constructor
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper>, BeanClassLoaderAware,
|
||||
ApplicationContextAware, InitializingBean {
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.aot.hint.TypeHint.Builder;
|
||||
*/
|
||||
class JacksonModulesRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static final Consumer<Builder> asJacksonModule = builder ->
|
||||
builder.onReachableType(Jackson2ObjectMapperBuilder.class)
|
||||
.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
|
||||
|
||||
@@ -44,7 +44,10 @@ import org.springframework.http.MediaType;
|
||||
* @author Juergen Hoeller
|
||||
* @author Sebastien Deleuze
|
||||
* @since 3.1.2
|
||||
* @deprecated since 7.0 in favor of {@link JacksonJsonHttpMessageConverter}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class MappingJackson2HttpMessageConverter extends AbstractJackson2HttpMessageConverter {
|
||||
|
||||
private static final List<MediaType> problemDetailMediaTypes =
|
||||
|
||||
@@ -30,7 +30,9 @@ import org.springframework.http.HttpInputMessage;
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
* @since 4.2
|
||||
* @deprecated since 7.0 in favor of using {@link org.springframework.http.converter.SmartHttpMessageConverter} hints
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
public class MappingJacksonInputMessage implements HttpInputMessage {
|
||||
|
||||
private final InputStream body;
|
||||
|
||||
@@ -33,7 +33,9 @@ import org.jspecify.annotations.Nullable;
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.1
|
||||
* @deprecated since 7.0 in favor of using {@link org.springframework.http.converter.SmartHttpMessageConverter} hints
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
public class MappingJacksonValue {
|
||||
|
||||
private Object value;
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Allows for creating Jackson ({@link JsonSerializer}, {@link JsonDeserializer},
|
||||
* Allows for creating Jackson 2.x ({@link JsonSerializer}, {@link JsonDeserializer},
|
||||
* {@link KeyDeserializer}, {@link TypeResolverBuilder}, {@link TypeIdResolver})
|
||||
* beans with autowiring against a Spring {@link ApplicationContext}.
|
||||
*
|
||||
@@ -53,7 +53,9 @@ import org.springframework.util.Assert;
|
||||
* @see Jackson2ObjectMapperBuilder#handlerInstantiator(HandlerInstantiator)
|
||||
* @see ApplicationContext#getAutowireCapableBeanFactory()
|
||||
* @see HandlerInstantiator
|
||||
* @deprecated since 7.0 in favor of {@link org.springframework.http.support.JacksonHandlerInstantiator}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
public class SpringHandlerInstantiator extends HandlerInstantiator {
|
||||
|
||||
private final AutowireCapableBeanFactory beanFactory;
|
||||
|
||||
@@ -37,7 +37,10 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
* @since 5.0
|
||||
* @deprecated since 7.0 in favor of {@link JacksonSmileHttpMessageConverter}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class MappingJackson2SmileHttpMessageConverter extends AbstractJackson2HttpMessageConverter {
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,6 +101,7 @@ public class AllEncompassingFormHttpMessageConverter extends FormHttpMessageConv
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public AllEncompassingFormHttpMessageConverter() {
|
||||
|
||||
if (jaxb2Present && !jacksonXmlPresent && !jackson2XmlPresent) {
|
||||
|
||||
@@ -41,7 +41,10 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
* @since 4.1
|
||||
* @deprecated since 7.0 in favor of {@link JacksonXmlHttpMessageConverter}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class MappingJackson2XmlHttpMessageConverter extends AbstractJackson2HttpMessageConverter {
|
||||
|
||||
private static final List<MediaType> problemDetailMediaTypes =
|
||||
|
||||
@@ -39,7 +39,10 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Hyoungjune Kim
|
||||
* @since 6.2
|
||||
* @deprecated since 7.0 in favor of {@link JacksonYamlHttpMessageConverter}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class MappingJackson2YamlHttpMessageConverter extends AbstractJackson2HttpMessageConverter {
|
||||
|
||||
/**
|
||||
|
||||
@@ -469,6 +469,7 @@ final class DefaultRestClientBuilder implements RestClient.Builder {
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private List<HttpMessageConverter<?>> initMessageConverters() {
|
||||
if (this.messageConverters == null) {
|
||||
this.messageConverters = new ArrayList<>();
|
||||
|
||||
@@ -202,6 +202,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
* Create a new instance with default settings.
|
||||
* Default {@link HttpMessageConverter HttpMessageConverters} are initialized.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public RestTemplate() {
|
||||
this.messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||
this.messageConverters.add(new StringHttpMessageConverter());
|
||||
|
||||
@@ -40,6 +40,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON;
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class Jackson2CborDecoderTests extends AbstractDecoderTests<Jackson2CborDecoder> {
|
||||
|
||||
private static final MimeType CBOR_MIME_TYPE = new MimeType("application", "cbor");
|
||||
|
||||
@@ -43,6 +43,7 @@ import static org.springframework.http.MediaType.APPLICATION_XML;
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class Jackson2CborEncoderTests extends AbstractLeakCheckingTests {
|
||||
|
||||
private static final MimeType CBOR_MIME_TYPE = new MimeType("application", "cbor");
|
||||
|
||||
@@ -62,6 +62,7 @@ import static org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW
|
||||
* @author Sebastien Deleuze
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class Jackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2JsonDecoder> {
|
||||
|
||||
private final Pojo pojo1 = new Pojo("f1", "b1");
|
||||
|
||||
@@ -50,12 +50,12 @@ import static org.springframework.http.MediaType.APPLICATION_JSON;
|
||||
import static org.springframework.http.MediaType.APPLICATION_NDJSON;
|
||||
import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM;
|
||||
import static org.springframework.http.MediaType.APPLICATION_XML;
|
||||
import static org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW_HINT;
|
||||
|
||||
/**
|
||||
* Tests for {@link Jackson2JsonEncoder}.
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonEncoder> {
|
||||
|
||||
public Jackson2JsonEncoderTests() {
|
||||
@@ -201,7 +201,8 @@ class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonEncoder>
|
||||
Mono<JacksonViewBean> input = Mono.just(bean);
|
||||
|
||||
ResolvableType type = ResolvableType.forClass(JacksonViewBean.class);
|
||||
Map<String, Object> hints = singletonMap(JSON_VIEW_HINT, MyJacksonView1.class);
|
||||
Map<String, Object> hints = singletonMap(org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW_HINT,
|
||||
MyJacksonView1.class);
|
||||
|
||||
testEncode(input, type, null, hints, step -> step
|
||||
.consumeNextWith(expectString("{\"withView1\":\"with\"}"))
|
||||
@@ -218,7 +219,8 @@ class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonEncoder>
|
||||
Mono<JacksonViewBean> input = Mono.just(bean);
|
||||
|
||||
ResolvableType type = ResolvableType.forClass(JacksonViewBean.class);
|
||||
Map<String, Object> hints = singletonMap(JSON_VIEW_HINT, MyJacksonView3.class);
|
||||
Map<String, Object> hints = singletonMap(org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW_HINT,
|
||||
MyJacksonView3.class);
|
||||
|
||||
testEncode(input, type, null, hints, step -> step
|
||||
.consumeNextWith(expectString("{\"withoutView\":\"without\"}"))
|
||||
|
||||
@@ -98,7 +98,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
* @author Eddú Meléndez
|
||||
* @author Hyoungjune Kim
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
class Jackson2ObjectMapperBuilderTests {
|
||||
|
||||
private static final String DATE_FORMAT = "yyyy-MM-dd";
|
||||
|
||||
@@ -61,6 +61,7 @@ import static org.assertj.core.api.Assertions.within;
|
||||
* @author Sebastien Deleuze
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class MappingJackson2HttpMessageConverterTests {
|
||||
|
||||
private final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
|
||||
|
||||
@@ -409,6 +409,7 @@ class RestTemplateIntegrationTests extends AbstractMockWebServerTests {
|
||||
|
||||
@ParameterizedRestTemplateTest
|
||||
@Disabled("Use RestClient + upcoming hint management instead")
|
||||
@SuppressWarnings("removal")
|
||||
void jsonPostForObjectWithJacksonJsonView(ClientHttpRequestFactory clientHttpRequestFactory) {
|
||||
setUpClient(clientHttpRequestFactory);
|
||||
|
||||
|
||||
@@ -561,6 +561,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
return (handlers != null ? extractBeanSubElements(handlers, context) : null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private ManagedList<?> getMessageConverters(Element element, @Nullable Object source, ParserContext context) {
|
||||
Element convertersElement = DomUtils.getChildElementByTagName(element, "message-converters");
|
||||
ManagedList<Object> messageConverters = new ManagedList<>();
|
||||
@@ -657,6 +658,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
return messageConverters;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private GenericBeanDefinition createObjectMapperFactoryDefinition(@Nullable Object source) {
|
||||
GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
|
||||
beanDefinition.setBeanClass(Jackson2ObjectMapperFactoryBean.class);
|
||||
|
||||
@@ -917,6 +917,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
* Subclasses can call this method from {@link #configureMessageConverters}.
|
||||
* @param messageConverters the list to add the default message converters to
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected final void addDefaultHttpMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
|
||||
messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||
messageConverters.add(new StringHttpMessageConverter());
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.http.server.ServerHttpResponse;
|
||||
* @author Sebastien Deleuze
|
||||
* @since 4.1
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public abstract class AbstractMappingJacksonResponseBodyAdvice implements ResponseBodyAdvice<Object> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,6 +51,7 @@ import org.springframework.util.Assert;
|
||||
* @see com.fasterxml.jackson.annotation.JsonView
|
||||
* @see com.fasterxml.jackson.databind.ObjectMapper#readerWithView(Class)
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public class JsonViewRequestBodyAdvice extends RequestBodyAdviceAdapter {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,6 +48,7 @@ import org.springframework.util.Assert;
|
||||
* @see com.fasterxml.jackson.annotation.JsonView
|
||||
* @see com.fasterxml.jackson.databind.ObjectMapper#writerWithView(Class)
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public class JsonViewResponseBodyAdvice extends AbstractMappingJacksonResponseBodyAdvice {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.http.converter.json.MappingJacksonValue;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.servlet.view.AbstractJacksonView;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
||||
/**
|
||||
@@ -46,7 +47,10 @@ import org.springframework.web.servlet.view.AbstractView;
|
||||
* @author Juergen Hoeller
|
||||
* @author Sebastien Deleuze
|
||||
* @since 4.1
|
||||
* @deprecated since 7.0 in favor of {@link AbstractJacksonView}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public abstract class AbstractJackson2View extends AbstractView {
|
||||
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@@ -48,7 +48,10 @@ import org.springframework.web.servlet.View;
|
||||
* @author Juergen Hoeller
|
||||
* @author Sebastien Deleuze
|
||||
* @since 3.1.2
|
||||
* @deprecated since 7.0 in favor of {@link JacksonJsonView}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class MappingJackson2JsonView extends AbstractJackson2View {
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,10 @@ import org.springframework.web.servlet.view.json.AbstractJackson2View;
|
||||
* @author Sebastien Deleuze
|
||||
* @since 4.1
|
||||
* @see org.springframework.web.servlet.view.json.MappingJackson2JsonView
|
||||
* @deprecated since 7.0 in favor of {@link JacksonXmlView}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class MappingJackson2XmlView extends AbstractJackson2View {
|
||||
|
||||
/**
|
||||
|
||||
@@ -519,6 +519,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void jackson2JsonViewWithResponseBodyAndJsonMessageConverter() throws Exception {
|
||||
Method method = JacksonController.class.getMethod("handleResponseBody");
|
||||
HandlerMethod handlerMethod = new HandlerMethod(new JacksonController(), method);
|
||||
@@ -557,6 +558,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void jackson2JsonViewWithResponseEntityAndJsonMessageConverter() throws Exception {
|
||||
Method method = JacksonController.class.getMethod("handleResponseEntity");
|
||||
HandlerMethod handlerMethod = new HandlerMethod(new JacksonController(), method);
|
||||
@@ -595,6 +597,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-12149
|
||||
@SuppressWarnings("removal")
|
||||
void jackson2JsonViewWithResponseBodyAndXmlMessageConverter() throws Exception {
|
||||
Method method = JacksonController.class.getMethod("handleResponseBody");
|
||||
HandlerMethod handlerMethod = new HandlerMethod(new JacksonController(), method);
|
||||
@@ -633,6 +636,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-12149
|
||||
@SuppressWarnings("removal")
|
||||
void jackson2JsonViewWithResponseEntityAndXmlMessageConverter() throws Exception {
|
||||
Method method = JacksonController.class.getMethod("handleResponseEntity");
|
||||
HandlerMethod handlerMethod = new HandlerMethod(new JacksonController(), method);
|
||||
@@ -675,6 +679,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-12501
|
||||
@SuppressWarnings("removal")
|
||||
void resolveArgumentWithJackson2JsonView() throws Exception {
|
||||
String content = "{\"withView1\" : \"with\", \"withView2\" : \"with\", \"withoutView\" : \"without\"}";
|
||||
this.servletRequest.setContent(content.getBytes(StandardCharsets.UTF_8));
|
||||
@@ -723,6 +728,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-12501
|
||||
@SuppressWarnings("removal")
|
||||
void resolveHttpEntityArgumentWithJackson2JsonView() throws Exception {
|
||||
String content = "{\"withView1\" : \"with\", \"withView2\" : \"with\", \"withoutView\" : \"without\"}";
|
||||
this.servletRequest.setContent(content.getBytes(StandardCharsets.UTF_8));
|
||||
@@ -774,6 +780,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-12501
|
||||
@SuppressWarnings("removal")
|
||||
void resolveArgumentWithJackson2JsonViewAndXmlMessageConverter() throws Exception {
|
||||
String content = "<root>" +
|
||||
"<withView1>with</withView1>" +
|
||||
@@ -828,6 +835,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-12501
|
||||
@SuppressWarnings("removal")
|
||||
void resolveHttpEntityArgumentWithJackson2JsonViewAndXmlMessageConverter() throws Exception {
|
||||
String content = "<root>" +
|
||||
"<withView1>with</withView1>" +
|
||||
@@ -873,6 +881,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-12811
|
||||
@SuppressWarnings("removal")
|
||||
void jackson2TypeInfoList() throws Exception {
|
||||
Method method = JacksonController.class.getMethod("handleTypeInfoList");
|
||||
HandlerMethod handlerMethod = new HandlerMethod(new JacksonController(), method);
|
||||
@@ -907,6 +916,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13318
|
||||
@SuppressWarnings("removal")
|
||||
void jackson2SubType() throws Exception {
|
||||
Method method = JacksonController.class.getMethod("handleSubType");
|
||||
HandlerMethod handlerMethod = new HandlerMethod(new JacksonController(), method);
|
||||
@@ -943,6 +953,7 @@ class RequestResponseBodyMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13318
|
||||
@SuppressWarnings("removal")
|
||||
void jackson2SubTypeList() throws Exception {
|
||||
Method method = JacksonController.class.getMethod("handleSubTypeList");
|
||||
HandlerMethod handlerMethod = new HandlerMethod(new JacksonController(), method);
|
||||
|
||||
@@ -97,6 +97,7 @@ public class SockJsClient implements WebSocketClient, Lifecycle {
|
||||
* otherwise is defaulted to {@link RestTemplateXhrTransport}.
|
||||
* @param transports the (non-empty) list of transports to use
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public SockJsClient(List<Transport> transports) {
|
||||
Assert.notEmpty(transports, "No transports provided");
|
||||
this.transports = new ArrayList<>(transports);
|
||||
|
||||
@@ -39,7 +39,10 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.0
|
||||
* @deprecated since 7.0 in favor of {@link JacksonJsonSockJsMessageCodec}
|
||||
*/
|
||||
@Deprecated(since = "7.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class Jackson2SockJsMessageCodec extends AbstractSockJsMessageCodec {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
@@ -109,6 +109,7 @@ public class TransportHandlingSockJsService extends AbstractSockJsService implem
|
||||
* initialized at start-up and shuts down when the application stops
|
||||
* @param handlers one or more {@link TransportHandler} implementations to use
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public TransportHandlingSockJsService(TaskScheduler scheduler, Collection<TransportHandler> handlers) {
|
||||
super(scheduler);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user