Fix Eclipse warnings caused by deprecation of Jackson 2 support

See gh-45535
This commit is contained in:
Andy Wilkinson
2025-05-14 10:21:30 +01:00
parent ee90996e5f
commit 379b2ceb56
16 changed files with 70 additions and 79 deletions

View File

@@ -31,8 +31,6 @@ import org.springframework.graphql.ExecutionGraphQlService;
import org.springframework.graphql.test.tester.ExecutionGraphQlServiceTester;
import org.springframework.graphql.test.tester.GraphQlTester;
import org.springframework.http.MediaType;
import org.springframework.http.codec.json.Jackson2JsonDecoder;
import org.springframework.http.codec.json.Jackson2JsonEncoder;
/**
* Auto-configuration for {@link GraphQlTester}.
@@ -49,14 +47,15 @@ public class GraphQlTesterAutoConfiguration {
@Bean
@ConditionalOnBean(ExecutionGraphQlService.class)
@ConditionalOnMissingBean
@SuppressWarnings("removal")
@SuppressWarnings({ "removal", "deprecation" })
public ExecutionGraphQlServiceTester graphQlTester(ExecutionGraphQlService graphQlService,
ObjectProvider<ObjectMapper> objectMapperProvider) {
ExecutionGraphQlServiceTester.Builder<?> builder = ExecutionGraphQlServiceTester.builder(graphQlService);
objectMapperProvider.ifAvailable((objectMapper) -> {
builder.encoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_GRAPHQL_RESPONSE,
MediaType.APPLICATION_JSON, APPLICATION_GRAPHQL));
builder.decoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON));
builder.encoder(new org.springframework.http.codec.json.Jackson2JsonEncoder(objectMapper,
MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, APPLICATION_GRAPHQL));
builder.decoder(new org.springframework.http.codec.json.Jackson2JsonDecoder(objectMapper,
MediaType.APPLICATION_JSON));
});
return builder.build();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-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.
@@ -28,7 +28,6 @@ import org.springframework.context.annotation.FilterType;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
@@ -187,7 +186,8 @@ class WebMvcTypeExcludeFilterTests {
}
@SuppressWarnings("removal")
static class ExampleMessageConverter extends MappingJackson2HttpMessageConverter {
static class ExampleMessageConverter
extends org.springframework.http.converter.json.MappingJackson2HttpMessageConverter {
}