Polish Jackson 3 support

- Improve Javadoc.

- Suppress warnings for "removal".

- Update copyright headers.

- Migrate several tests from:
  - MappingJackson2MessageConverter to JacksonJsonMessageConverter
  - Jackson2JsonEncoder to JacksonJsonEncoder
  - Jackson2JsonDecoder to JacksonJsonDecoder
  - Jackson2SmileEncoder to JacksonSmileEncoder
  - Jackson2ObjectMapperBuilder to JsonMapper and XmlMapper
  - MappingJackson2JsonView to JacksonJsonView
  - MappingJackson2HttpMessageConverter to JacksonJsonHttpMessageConverter
  - MappingJackson2XmlHttpMessageConverter to JacksonXmlHttpMessageConverter
This commit is contained in:
Sam Brannen
2025-05-14 16:55:27 +02:00
parent ea340fbe69
commit 01fea5e7ed
88 changed files with 402 additions and 346 deletions

View File

@@ -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.
@@ -39,7 +39,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ReactiveHttpOutputMessage;
import org.springframework.http.client.MultipartBodyBuilder;
import org.springframework.http.codec.json.Jackson2JsonEncoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.http.codec.multipart.MultipartHttpMessageWriter;
import org.springframework.http.codec.protobuf.ProtobufDecoder;
import org.springframework.http.codec.protobuf.ProtobufEncoder;
@@ -76,7 +76,7 @@ class CancelWithoutDemandCodecTests {
@Test // gh-22107
public void cancelWithJackson() {
Jackson2JsonEncoder encoder = new Jackson2JsonEncoder();
JacksonJsonEncoder encoder = new JacksonJsonEncoder();
Flux<DataBuffer> flux = encoder.encode(Flux.just(new Pojo("foofoo", "barbar"), new Pojo("bar", "baz")),
this.bufferFactory, ResolvableType.forClass(Pojo.class),
@@ -150,7 +150,7 @@ class CancelWithoutDemandCodecTests {
@Test // gh-22107
public void cancelWithSse() {
ServerSentEvent<?> event = ServerSentEvent.builder().data("bar").id("c42").event("foo").build();
ServerSentEventHttpMessageWriter writer = new ServerSentEventHttpMessageWriter(new Jackson2JsonEncoder());
ServerSentEventHttpMessageWriter writer = new ServerSentEventHttpMessageWriter(new JacksonJsonEncoder());
CancellingOutputMessage outputMessage = new CancellingOutputMessage(this.bufferFactory);
writer.write(Mono.just(event), ResolvableType.forClass(ServerSentEvent.class), MediaType.TEXT_EVENT_STREAM,
@@ -229,4 +229,5 @@ class CancelWithoutDemandCodecTests {
// Just subscribe without requesting
}
}
}

View File

@@ -24,7 +24,6 @@ import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.CompositeByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.json.JSONException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import reactor.core.publisher.Flux;
@@ -50,16 +49,11 @@ import static org.assertj.core.api.Assertions.assertThat;
* Tests for {@link JacksonTokenizer}.
*
* @author Sebastien Deleuze
* @since 7.0
*/
class JacksonTokenizerTests extends AbstractLeakCheckingTests {
private ObjectMapper objectMapper;
@BeforeEach
void createParser() {
this.objectMapper = JsonMapper.builder().build();
}
private final ObjectMapper objectMapper = JsonMapper.builder().build();
@Test

View File

@@ -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.
@@ -30,7 +30,6 @@ import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferLimitException;
import org.springframework.core.testfixture.io.buffer.AbstractLeakCheckingTests;
import org.springframework.http.MediaType;
import org.springframework.http.codec.json.Jackson2JsonDecoder;
import org.springframework.http.codec.json.JacksonJsonDecoder;
import org.springframework.web.testfixture.http.server.reactive.MockServerHttpRequest;
import org.springframework.web.testfixture.xml.Pojo;
@@ -227,7 +226,7 @@ class ServerSentEventHttpMessageReaderTests extends AbstractLeakCheckingTests {
String content = "data:{\"foo\": \"" + fooValue + "\"}\n\n";
MockServerHttpRequest request = MockServerHttpRequest.post("/").body(Mono.just(stringBuffer(content)));
Jackson2JsonDecoder jacksonDecoder = new Jackson2JsonDecoder();
JacksonJsonDecoder jacksonDecoder = new JacksonJsonDecoder();
ServerSentEventHttpMessageReader messageReader = new ServerSentEventHttpMessageReader(jacksonDecoder);
jacksonDecoder.setMaxInMemorySize(limit + 1024);

View File

@@ -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.
@@ -35,6 +35,7 @@ import org.springframework.core.testfixture.codec.AbstractDecoderTests;
*
* @author Jason Laber
*/
@SuppressWarnings("removal")
class CustomizedJackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2JsonDecoder> {
CustomizedJackson2JsonDecoderTests() {

View File

@@ -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.
@@ -35,6 +35,7 @@ import static org.springframework.http.MediaType.APPLICATION_NDJSON;
*
* @author Jason Laber
*/
@SuppressWarnings("removal")
class CustomizedJackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonEncoder> {
CustomizedJackson2JsonEncoderTests() {

View File

@@ -34,6 +34,7 @@ import org.springframework.core.testfixture.codec.AbstractDecoderTests;
* Tests for a customized {@link JacksonJsonDecoder}.
*
* @author Sebastien Deleuze
* @since 7.0
*/
class CustomizedJacksonJsonDecoderTests extends AbstractDecoderTests<JacksonJsonDecoder> {

View File

@@ -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.
@@ -54,7 +54,6 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static org.springframework.http.MediaType.APPLICATION_NDJSON;
import static org.springframework.http.MediaType.APPLICATION_XML;
import static org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW_HINT;
/**
* Tests for {@link Jackson2JsonDecoder}.
@@ -201,7 +200,8 @@ class Jackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2JsonDecoder>
"{\"withView1\" : \"with\", \"withView2\" : \"with\", \"withoutView\" : \"without\"}"));
ResolvableType elementType = ResolvableType.forClass(JacksonViewBean.class);
Map<String, Object> hints = Collections.singletonMap(JSON_VIEW_HINT, MyJacksonView1.class);
Map<String, Object> hints = Map.of(
org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW_HINT, MyJacksonView1.class);
testDecode(input, elementType, step -> step
.consumeNextWith(value -> {
@@ -218,7 +218,8 @@ class Jackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2JsonDecoder>
"{\"withView1\" : \"with\", \"withView2\" : \"with\", \"withoutView\" : \"without\"}"));
ResolvableType elementType = ResolvableType.forClass(JacksonViewBean.class);
Map<String, Object> hints = Collections.singletonMap(JSON_VIEW_HINT, MyJacksonView3.class);
Map<String, Object> hints = Map.of(
org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW_HINT, MyJacksonView3.class);
testDecode(input, elementType, step -> step
.consumeNextWith(value -> {

View File

@@ -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.

View File

@@ -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.
@@ -39,6 +39,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON;
*
* @author Sebastien Deleuze
*/
@SuppressWarnings("removal")
class Jackson2SmileDecoderTests extends AbstractDecoderTests<Jackson2SmileDecoder> {
private static final MimeType SMILE_MIME_TYPE = new MimeType("application", "x-jackson-smile");

View File

@@ -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.
@@ -46,16 +46,15 @@ import static org.springframework.http.MediaType.APPLICATION_XML;
*
* @author Sebastien Deleuze
*/
@SuppressWarnings("removal")
class Jackson2SmileEncoderTests extends AbstractEncoderTests<Jackson2SmileEncoder> {
private static final MimeType SMILE_MIME_TYPE = new MimeType("application", "x-jackson-smile");
private static final MimeType STREAM_SMILE_MIME_TYPE = new MimeType("application", "stream+x-jackson-smile");
private final Jackson2SmileEncoder encoder = new Jackson2SmileEncoder();
private final ObjectMapper mapper = Jackson2ObjectMapperBuilder.smile().build();
public Jackson2SmileEncoderTests() {
Jackson2SmileEncoderTests() {
super(new Jackson2SmileEncoder());
}

View File

@@ -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.
@@ -54,6 +54,7 @@ import static org.assertj.core.api.Assertions.fail;
* @author Rossen Stoyanchev
* @author Juergen Hoeller
*/
@SuppressWarnings("removal")
class Jackson2TokenizerTests extends AbstractLeakCheckingTests {
private JsonFactory jsonFactory;

View File

@@ -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.
@@ -39,6 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* Tests for {@link AbstractJackson2Encoder} for the CSV variant and how resources are managed.
* @author Brian Clozel
*/
@SuppressWarnings("removal")
class JacksonCsvEncoderTests extends AbstractEncoderTests<org.springframework.http.codec.json.JacksonCsvEncoderTests.JacksonCsvEncoder> {
public JacksonCsvEncoderTests() {

View File

@@ -60,6 +60,7 @@ import static org.springframework.http.codec.JacksonCodecSupport.JSON_VIEW_HINT;
* Tests for {@link JacksonJsonDecoder}.
*
* @author Sebastien Deleuze
* @since 7.0
*/
class JacksonJsonDecoderTests extends AbstractDecoderTests<JacksonJsonDecoder> {
@@ -73,8 +74,8 @@ class JacksonJsonDecoderTests extends AbstractDecoderTests<JacksonJsonDecoder> {
}
@Override
@Test
@Override
public void canDecode() {
assertThat(decoder.canDecode(ResolvableType.forClass(Pojo.class), APPLICATION_JSON)).isTrue();
assertThat(decoder.canDecode(ResolvableType.forClass(Pojo.class), APPLICATION_NDJSON)).isTrue();
@@ -109,7 +110,6 @@ class JacksonJsonDecoderTests extends AbstractDecoderTests<JacksonJsonDecoder> {
assertThat(decoder.canDecode(ResolvableType.forClass(Pojo.class), MediaType.APPLICATION_JSON)).isTrue();
assertThat(decoder.canDecode(ResolvableType.forClass(Pojo.class), halFormsJsonMediaType)).isFalse();
assertThat(decoder.canDecode(ResolvableType.forClass(Map.class), MediaType.APPLICATION_JSON)).isTrue();
}
@Test // SPR-15866
@@ -142,8 +142,8 @@ class JacksonJsonDecoderTests extends AbstractDecoderTests<JacksonJsonDecoder> {
.containsExactly(mimeType1);
}
@Override
@Test
@Override
protected void decode() {
Flux<DataBuffer> input = Flux.concat(
stringBuffer("[{\"bar\":\"b1\",\"foo\":\"f1\"},"),
@@ -155,8 +155,8 @@ class JacksonJsonDecoderTests extends AbstractDecoderTests<JacksonJsonDecoder> {
.verifyComplete());
}
@Override
@Test
@Override
protected void decodeToMono() {
Flux<DataBuffer> input = Flux.concat(
stringBuffer("[{\"bar\":\"b1\",\"foo\":\"f1\"},"),
@@ -260,7 +260,7 @@ class JacksonJsonDecoderTests extends AbstractDecoderTests<JacksonJsonDecoder> {
void codecException() {
Flux<DataBuffer> input = Flux.from(stringBuffer("["));
ResolvableType elementType = ResolvableType.forClass(BeanWithNoDefaultConstructor.class);
Flux<Object> flux = new Jackson2JsonDecoder().decode(input, elementType, null, Collections.emptyMap());
Flux<Object> flux = new JacksonJsonDecoder().decode(input, elementType, null, Collections.emptyMap());
StepVerifier.create(flux).verifyError(CodecException.class);
}

View File

@@ -55,7 +55,9 @@ import static org.springframework.http.codec.JacksonCodecSupport.JSON_VIEW_HINT;
/**
* Tests for {@link JacksonJsonEncoder}.
*
* @author Sebastien Deleuze
* @since 7.0
*/
class JacksonJsonEncoderTests extends AbstractEncoderTests<JacksonJsonEncoder> {
@@ -63,8 +65,9 @@ class JacksonJsonEncoderTests extends AbstractEncoderTests<JacksonJsonEncoder> {
super(new JacksonJsonEncoder());
}
@Override
@Test
@Override
@SuppressWarnings("removal")
public void canEncode() {
ResolvableType pojoType = ResolvableType.forClass(Pojo.class);
assertThat(this.encoder.canEncode(pojoType, APPLICATION_JSON)).isTrue();
@@ -88,8 +91,8 @@ class JacksonJsonEncoderTests extends AbstractEncoderTests<JacksonJsonEncoder> {
.isInstanceOf(UnsupportedOperationException.class);
}
@Override
@Test
@Override
public void encode() throws Exception {
Flux<Object> input = Flux.just(new Pojo("foo", "bar"),
new Pojo("foofoo", "barbar"),

View File

@@ -36,6 +36,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON;
* Tests for {@link JacksonSmileDecoder}.
*
* @author Sebastien Deleuze
* @since 7.0
*/
class JacksonSmileDecoderTests extends AbstractDecoderTests<JacksonSmileDecoder> {
@@ -48,10 +49,12 @@ class JacksonSmileDecoderTests extends AbstractDecoderTests<JacksonSmileDecoder>
private SmileMapper mapper = SmileMapper.builder().build();
public JacksonSmileDecoderTests() {
JacksonSmileDecoderTests() {
super(new JacksonSmileDecoder());
}
@Override
@Test
protected void canDecode() {

View File

@@ -19,6 +19,7 @@ package org.springframework.http.codec.smile;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -31,7 +32,6 @@ import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.core.testfixture.codec.AbstractEncoderTests;
import org.springframework.http.codec.ServerSentEvent;
import org.springframework.http.codec.json.Jackson2SmileEncoder;
import org.springframework.util.MimeType;
import org.springframework.web.testfixture.xml.Pojo;
@@ -43,23 +43,23 @@ import static org.springframework.http.MediaType.APPLICATION_XML;
* Tests for {@link JacksonSmileEncoder}.
*
* @author Sebastien Deleuze
* @since 7.0
*/
class JacksonSmileEncoderTests extends AbstractEncoderTests<JacksonSmileEncoder> {
private static final MimeType SMILE_MIME_TYPE = new MimeType("application", "x-jackson-smile");
private static final MimeType STREAM_SMILE_MIME_TYPE = new MimeType("application", "stream+x-jackson-smile");
private final Jackson2SmileEncoder encoder = new Jackson2SmileEncoder();
private final SmileMapper mapper = SmileMapper.builder().build();
public JacksonSmileEncoderTests() {
super(new JacksonSmileEncoder());
JacksonSmileEncoderTests() {
super(new JacksonSmileEncoder());
}
@Override
@Test
@Override
protected void canEncode() {
ResolvableType pojoType = ResolvableType.forClass(Pojo.class);
assertThat(this.encoder.canEncode(pojoType, SMILE_MIME_TYPE)).isTrue();
@@ -71,16 +71,20 @@ class JacksonSmileEncoderTests extends AbstractEncoderTests<JacksonSmileEncoder>
}
@Test
void canNotEncode() {
void cannotEncode() {
assertThat(this.encoder.canEncode(ResolvableType.forClass(String.class), null)).isFalse();
assertThat(this.encoder.canEncode(ResolvableType.forClass(Pojo.class), APPLICATION_XML)).isFalse();
}
@Test
@Disabled("Determine why this fails with JacksonSmileEncoder but passes with Jackson2SmileEncoder")
void cannotEncodeServerSentEvent() {
ResolvableType sseType = ResolvableType.forClass(ServerSentEvent.class);
assertThat(this.encoder.canEncode(sseType, SMILE_MIME_TYPE)).isFalse();
}
@Override
@Test
@Override
protected void encode() {
List<Pojo> list = Arrays.asList(
new Pojo("foo", "bar"),

View File

@@ -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.
@@ -72,7 +72,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
* @author Sebastien Deleuze
* @author Sam Brannen
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "removal" })
public class Jackson2ObjectMapperFactoryBeanTests {
private static final String DATE_FORMAT = "yyyy-MM-dd";

View File

@@ -98,6 +98,7 @@ class JacksonJsonHttpMessageConverterTests {
}
@Test
@SuppressWarnings("removal")
void canWrite() {
assertThat(converter.canWrite(MyBean.class, MediaType.APPLICATION_JSON)).isTrue();
assertThat(converter.canWrite(Map.class, MediaType.APPLICATION_JSON)).isTrue();
@@ -331,8 +332,8 @@ class JacksonJsonHttpMessageConverterTests {
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes(StandardCharsets.UTF_8));
inputMessage.getHeaders().setContentType(MediaType.APPLICATION_JSON);
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
List<MyBean> results = (List<MyBean>) converter.read(beansList.getType(), null, inputMessage);
JacksonJsonHttpMessageConverter converter = new JacksonJsonHttpMessageConverter();
List<MyBean> results = (List<MyBean>) converter.read(ResolvableType.forType(beansList), inputMessage, null);
assertThat(results).hasSize(1);
MyBean result = results.get(0);
assertThat(result.getString()).isEqualTo("Foo");
@@ -343,12 +344,11 @@ class JacksonJsonHttpMessageConverterTests {
assertThat(result.getBytes()).isEqualTo(new byte[] {0x1, 0x2});
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
converter.write(results, baseList.getType(), MediaType.APPLICATION_JSON, outputMessage);
converter.write(results, ResolvableType.forType(baseList), MediaType.APPLICATION_JSON, outputMessage, null);
JSONAssert.assertEquals(body, outputMessage.getBodyAsString(StandardCharsets.UTF_8), true);
}
// gh-24498
@Test
@Test // gh-24498
void writeOptional() throws IOException {
ParameterizedTypeReference<Optional<MyParent>> optionalParent = new ParameterizedTypeReference<>() {};
Optional<MyParent> result = Optional.of(new Impl1());
@@ -356,8 +356,7 @@ class JacksonJsonHttpMessageConverterTests {
converter.write(result, ResolvableType.forType(optionalParent.getType()),
MediaType.APPLICATION_JSON, outputMessage, null);
assertThat(outputMessage.getBodyAsString(StandardCharsets.UTF_8))
.contains("@type");
assertThat(outputMessage.getBodyAsString(StandardCharsets.UTF_8)).contains("@type");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 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.
@@ -18,9 +18,11 @@ package org.springframework.http.converter.json;
import java.net.URI;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;
import tools.jackson.dataformat.xml.XmlMapper;
import org.springframework.http.HttpStatus;
import org.springframework.http.ProblemDetail;
@@ -36,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
class ProblemDetailJacksonMixinTests {
private final ObjectMapper mapper = new Jackson2ObjectMapperBuilder().build();
private final ObjectMapper mapper = JsonMapper.builder().addMixIn(ProblemDetail.class, ProblemDetailJacksonMixin.class).build();
@Test
@@ -92,7 +94,7 @@ class ProblemDetailJacksonMixinTests {
@Test
void readCustomPropertyFromXml() throws Exception {
ObjectMapper xmlMapper = new Jackson2ObjectMapperBuilder().createXmlMapper(true).build();
ObjectMapper xmlMapper = XmlMapper.builder().addMixIn(ProblemDetail.class, ProblemDetailJacksonMixin.class).build();
ProblemDetail detail = xmlMapper.readValue("""
<problem xmlns="urn:ietf:rfc:7807">
<type>about:blank</type>

View File

@@ -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.
@@ -61,6 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Sebastien Deleuze
*/
@SuppressWarnings("removal")
class SpringHandlerInstantiatorTests {
private SpringHandlerInstantiator instantiator;

View File

@@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.within;
* Jackson 3.x Smile converter tests.
*
* @author Sebastien Deleuze
* @since 7.0
*/
class JacksonSmileHttpMessageConverterTests {

View File

@@ -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.
@@ -34,6 +34,7 @@ import static org.assertj.core.api.Assertions.within;
*
* @author Sebastien Deleuze
*/
@SuppressWarnings("removal")
class MappingJackson2SmileHttpMessageConverterTests {
private final MappingJackson2SmileHttpMessageConverter converter = new MappingJackson2SmileHttpMessageConverter();

View File

@@ -41,6 +41,7 @@ import static org.assertj.core.api.Assertions.within;
* Jackson 3.x XML converter tests.
*
* @author Sebastien Deleuze
* @since 7.0
*/
class JacksonXmlHttpMessageConverterTests {
@@ -313,6 +314,7 @@ class JacksonXmlHttpMessageConverterTests {
}
@SuppressWarnings("serial")
private static class MyXmlMapper extends XmlMapper {
}

View File

@@ -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.
@@ -41,6 +41,7 @@ import static org.assertj.core.api.Assertions.within;
* @author Sebastien Deleuze
* @author Rossen Stoyanchev
*/
@SuppressWarnings("removal")
class MappingJackson2XmlHttpMessageConverterTests {
private final MappingJackson2XmlHttpMessageConverter converter = new MappingJackson2XmlHttpMessageConverter();

View File

@@ -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.
@@ -43,7 +43,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseCookie;
import org.springframework.http.codec.EncoderHttpMessageWriter;
import org.springframework.http.codec.HttpMessageWriter;
import org.springframework.http.codec.json.Jackson2JsonEncoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.web.testfixture.http.server.reactive.MockServerHttpRequest;
import org.springframework.web.testfixture.http.server.reactive.MockServerHttpResponse;
@@ -205,7 +205,7 @@ class ServerHttpResponseTests {
throw AbortedException.beforeSend();
});
HttpMessageWriter<Object> messageWriter = new EncoderHttpMessageWriter<>(new Jackson2JsonEncoder());
HttpMessageWriter<Object> messageWriter = new EncoderHttpMessageWriter<>(new JacksonJsonEncoder());
Mono<Void> result = messageWriter.write(Mono.just(Collections.singletonMap("foo", "bar")),
ResolvableType.forClass(Mono.class), ResolvableType.forClass(Map.class), null,
request, response, Collections.emptyMap());

View File

@@ -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.
@@ -32,7 +32,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.json.JacksonJsonHttpMessageConverter;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -54,7 +54,7 @@ class ExtractingResponseErrorHandlerTests {
@BeforeEach
void setup() {
HttpMessageConverter<Object> converter = new MappingJackson2HttpMessageConverter();
HttpMessageConverter<Object> converter = new JacksonJsonHttpMessageConverter();
this.errorHandler = new ExtractingResponseErrorHandler(List.of(converter));
this.errorHandler.setStatusMapping(Map.of(HttpStatus.I_AM_A_TEAPOT, MyRestClientException.class));