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:
Sébastien Deleuze
2025-05-13 16:37:54 +02:00
parent 6ae89ea397
commit 2a29e16456
60 changed files with 141 additions and 7 deletions

View File

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

View File

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

View File

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

View File

@@ -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\"}"))

View File

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

View File

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

View File

@@ -409,6 +409,7 @@ class RestTemplateIntegrationTests extends AbstractMockWebServerTests {
@ParameterizedRestTemplateTest
@Disabled("Use RestClient + upcoming hint management instead")
@SuppressWarnings("removal")
void jsonPostForObjectWithJacksonJsonView(ClientHttpRequestFactory clientHttpRequestFactory) {
setUpClient(clientHttpRequestFactory);