diff --git a/build.gradle b/build.gradle index 1686f6ed..83ce2c9f 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ description = "Spring for GraphQL" ext { moduleProjects = [project(":spring-graphql"), project(":spring-graphql-test")] - springFrameworkVersion = "7.0.0-M4" + springFrameworkVersion = "7.0.0-M5" graphQlJavaVersion = "24.0" springBootVersion = "3.4.3" } diff --git a/platform/build.gradle b/platform/build.gradle index efb149aa..cd8e406b 100644 --- a/platform/build.gradle +++ b/platform/build.gradle @@ -8,7 +8,7 @@ javaPlatform { dependencies { api(platform("org.springframework:spring-framework-bom:${springFrameworkVersion}")) - api(platform("com.fasterxml.jackson:jackson-bom:2.18.3")) + api(platform("tools.jackson:jackson-bom:3.0.0-rc4")) api(platform("io.projectreactor:reactor-bom:2025.0.0-M3")) api(platform("io.micrometer:micrometer-bom:1.15.0")) api(platform("io.micrometer:micrometer-tracing-bom:1.5.0")) diff --git a/spring-graphql-docs/modules/ROOT/pages/data.adoc b/spring-graphql-docs/modules/ROOT/pages/data.adoc index ba42f93f..eb23c353 100644 --- a/spring-graphql-docs/modules/ROOT/pages/data.adoc +++ b/spring-graphql-docs/modules/ROOT/pages/data.adoc @@ -452,8 +452,8 @@ You can then create `JsonKeysetCursorStrategy`: ObjectMapper mapper = ... ; CodecConfigurer configurer = ServerCodecConfigurer.create(); - configurer.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(mapper)); - configurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(mapper)); + configurer.defaultCodecs().jacksonJsonDecoder(new JacksonJsonDecoder(mapper)); + configurer.defaultCodecs().jacksonJsonEncoder(new JacksonJsonEncoder(mapper)); JsonKeysetCursorStrategy strategy = new JsonKeysetCursorStrategy(configurer); ---- diff --git a/spring-graphql-test/build.gradle b/spring-graphql-test/build.gradle index e4ad6e38..d2c5b112 100644 --- a/spring-graphql-test/build.gradle +++ b/spring-graphql-test/build.gradle @@ -14,6 +14,7 @@ dependencies { compileOnly 'org.springframework:spring-websocket' compileOnly 'org.springframework:spring-messaging' compileOnly 'jakarta.servlet:jakarta.servlet-api' + compileOnly 'tools.jackson.core:jackson-databind' compileOnly 'io.rsocket:rsocket-core' compileOnly 'io.rsocket:rsocket-transport-netty' compileOnly 'org.skyscreamer:jsonassert' @@ -32,7 +33,7 @@ dependencies { testImplementation 'io.projectreactor.netty:reactor-netty' testImplementation 'io.rsocket:rsocket-transport-local' testImplementation 'io.micrometer:context-propagation' - testImplementation 'com.fasterxml.jackson.core:jackson-databind' + testImplementation 'tools.jackson.core:jackson-databind' testRuntimeOnly 'org.apache.logging.log4j:log4j-core' testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl' diff --git a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/AbstractGraphQlTesterBuilder.java b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/AbstractGraphQlTesterBuilder.java index 5fd62028..4de7fc07 100644 --- a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/AbstractGraphQlTesterBuilder.java +++ b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/AbstractGraphQlTesterBuilder.java @@ -24,8 +24,6 @@ import java.util.function.Function; import java.util.function.Predicate; import com.jayway.jsonpath.Configuration; -import com.jayway.jsonpath.spi.json.JacksonJsonProvider; -import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; import com.jayway.jsonpath.spi.mapper.MappingProvider; import org.jspecify.annotations.Nullable; import reactor.core.publisher.Flux; @@ -60,8 +58,8 @@ import org.springframework.util.ClassUtils; */ public abstract class AbstractGraphQlTesterBuilder> implements GraphQlTester.Builder { - private static final boolean jackson2Present = ClassUtils.isPresent( - "com.fasterxml.jackson.databind.ObjectMapper", AbstractGraphQlClientBuilder.class.getClassLoader()); + private static final boolean jacksonPresent = ClassUtils.isPresent( + "tools.jackson.databind.ObjectMapper", AbstractGraphQlClientBuilder.class.getClassLoader()); private static final Duration DEFAULT_RESPONSE_DURATION = Duration.ofSeconds(5); @@ -130,8 +128,8 @@ public abstract class AbstractGraphQlTesterBuilder defaultJsonProviderType; diff --git a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/JacksonJsonProvider.java b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/JacksonJsonProvider.java new file mode 100644 index 00000000..7fd6585b --- /dev/null +++ b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/JacksonJsonProvider.java @@ -0,0 +1,88 @@ +/* + * Copyright 2020-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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.graphql.test.tester; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringWriter; +import java.util.LinkedHashMap; +import java.util.LinkedList; + +import com.jayway.jsonpath.InvalidJsonException; +import com.jayway.jsonpath.spi.json.AbstractJsonProvider; +import tools.jackson.core.JacksonException; +import tools.jackson.core.JsonGenerator; +import tools.jackson.databind.ObjectMapper; +import tools.jackson.databind.ObjectReader; + +/** + * {@link com.jayway.jsonpath.spi.json.JsonProvider} for Jackson 3.x. + * @author Brian Clozel + */ +class JacksonJsonProvider extends AbstractJsonProvider { + + private final ObjectMapper objectMapper = new ObjectMapper(); + + private final ObjectReader objectReader = this.objectMapper.reader(); + + @Override + public Object parse(String json) throws InvalidJsonException { + try { + return this.objectReader.readValue(json); + } + catch (JacksonException exc) { + throw new InvalidJsonException(exc, json); + } + } + + @Override + public Object parse(InputStream jsonStream, String charset) throws InvalidJsonException { + try { + return this.objectReader.readValue(new InputStreamReader(jsonStream, charset)); + } + catch (IOException exc) { + throw new InvalidJsonException(exc); + } + } + + @Override + public String toJson(Object obj) { + StringWriter writer = new StringWriter(); + try { + JsonGenerator generator = this.objectMapper.createGenerator(writer); + this.objectMapper.writeValue(generator, obj); + writer.flush(); + writer.close(); + generator.close(); + return writer.getBuffer().toString(); + } + catch (IOException exc) { + throw new InvalidJsonException(exc); + } + } + + @Override + public Object createArray() { + return new LinkedList(); + } + + @Override + public Object createMap() { + return new LinkedHashMap(); + } +} diff --git a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/JacksonMappingProvider.java b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/JacksonMappingProvider.java new file mode 100644 index 00000000..e01dc3bf --- /dev/null +++ b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/JacksonMappingProvider.java @@ -0,0 +1,65 @@ +/* + * Copyright 2020-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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.graphql.test.tester; + +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.TypeRef; +import com.jayway.jsonpath.spi.mapper.MappingException; +import com.jayway.jsonpath.spi.mapper.MappingProvider; +import org.jspecify.annotations.Nullable; +import tools.jackson.databind.JavaType; +import tools.jackson.databind.ObjectMapper; + +/** + * {@link MappingProvider} for Jackson 3.x. + * @author Brian Clozel + */ +class JacksonMappingProvider implements MappingProvider { + + private final ObjectMapper objectMapper = new ObjectMapper(); + + @Override + public @Nullable T map(@Nullable Object source, Class targetType, Configuration configuration) { + if (source == null) { + return null; + } + try { + return this.objectMapper.convertValue(source, targetType); + } + catch (Exception exc) { + throw new MappingException(exc); + } + + } + + @Override + @SuppressWarnings("unchecked") + public @Nullable T map(@Nullable Object source, final TypeRef targetType, Configuration configuration) { + if (source == null) { + return null; + } + JavaType type = this.objectMapper.getTypeFactory().constructType(targetType.getType()); + + try { + return (T) this.objectMapper.convertValue(source, type); + } + catch (Exception exc) { + throw new MappingException(exc); + } + + } +} diff --git a/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/GraphQlTesterBuilderTests.java b/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/GraphQlTesterBuilderTests.java index 7defe7e1..af90d5d5 100644 --- a/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/GraphQlTesterBuilderTests.java +++ b/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/GraphQlTesterBuilderTests.java @@ -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. @@ -31,8 +31,8 @@ import org.springframework.core.io.buffer.DataBuffer; import org.springframework.graphql.ExecutionGraphQlRequest; import org.springframework.graphql.ExecutionGraphQlService; import org.springframework.graphql.support.DocumentSource; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; +import org.springframework.http.codec.json.JacksonJsonDecoder; +import org.springframework.http.codec.json.JacksonJsonEncoder; import org.springframework.lang.Nullable; import org.springframework.util.MimeType; @@ -91,10 +91,10 @@ class GraphQlTesterBuilderTests extends GraphQlTesterTestSupport { @Test void codecConfigurerRegistersJsonPathMappingProvider() { - TestJackson2JsonDecoder testDecoder = new TestJackson2JsonDecoder(); + TestJacksonJsonDecoder testDecoder = new TestJacksonJsonDecoder(); ExecutionGraphQlServiceTester.Builder builder = graphQlTesterBuilder() - .encoder(new Jackson2JsonEncoder()) + .encoder(new JacksonJsonEncoder()) .decoder(testDecoder); String document = "{me {name}}"; @@ -138,7 +138,7 @@ class GraphQlTesterBuilderTests extends GraphQlTesterTestSupport { } - private static class TestJackson2JsonDecoder extends Jackson2JsonDecoder { + private static class TestJacksonJsonDecoder extends JacksonJsonDecoder { @Nullable private Object lastValue; diff --git a/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/RSocketGraphQlTesterBuilderTests.java b/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/RSocketGraphQlTesterBuilderTests.java index 20a46712..afece26b 100644 --- a/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/RSocketGraphQlTesterBuilderTests.java +++ b/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/RSocketGraphQlTesterBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 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. @@ -36,8 +36,8 @@ import org.springframework.core.io.buffer.DataBuffer; import org.springframework.graphql.GraphQlRequest; import org.springframework.graphql.execution.MockExecutionGraphQlService; import org.springframework.graphql.server.GraphQlRSocketHandler; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; +import org.springframework.http.codec.json.JacksonJsonDecoder; +import org.springframework.http.codec.json.JacksonJsonEncoder; import org.springframework.lang.Nullable; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.rsocket.RSocketStrategies; @@ -87,12 +87,12 @@ class RSocketGraphQlTesterBuilderTests { @Test void rsocketStrategiesRegistersJsonPathMappingProvider() { - TestJackson2JsonDecoder testDecoder = new TestJackson2JsonDecoder(); + TestJacksonJsonDecoder testDecoder = new TestJacksonJsonDecoder(); RSocketGraphQlTester.Builder builder = this.builderSetup.initBuilder() .rsocketRequester(requesterBuilder -> { RSocketStrategies strategies = RSocketStrategies.builder() - .encoder(new Jackson2JsonEncoder()) + .encoder(new JacksonJsonEncoder()) .decoder(testDecoder) .build(); requesterBuilder.rsocketStrategies(strategies); @@ -132,7 +132,7 @@ class RSocketGraphQlTesterBuilderTests { public RSocketGraphQlTester.Builder initBuilder() { GraphQlRSocketController controller = new GraphQlRSocketController( - new GraphQlRSocketHandler(this.graphQlService, Collections.emptyList(), new Jackson2JsonEncoder())); + new GraphQlRSocketHandler(this.graphQlService, Collections.emptyList(), new JacksonJsonEncoder())); this.server = RSocketServer.create() .acceptor(createSocketAcceptor(controller)) @@ -146,8 +146,8 @@ class RSocketGraphQlTesterBuilderTests { private SocketAcceptor createSocketAcceptor(GraphQlRSocketController controller) { RSocketStrategies.Builder builder = RSocketStrategies.builder(); - builder.encoder(new Jackson2JsonEncoder()); - builder.decoder(new Jackson2JsonDecoder()); + builder.encoder(new JacksonJsonEncoder()); + builder.decoder(new JacksonJsonDecoder()); RSocketMessageHandler handler = new RSocketMessageHandler(); handler.setHandlers(Collections.singletonList(controller)); @@ -195,7 +195,7 @@ class RSocketGraphQlTesterBuilderTests { } - private static class TestJackson2JsonDecoder extends Jackson2JsonDecoder { + private static class TestJacksonJsonDecoder extends JacksonJsonDecoder { @Nullable private Object lastValue; diff --git a/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/WebGraphQlTesterBuilderTests.java b/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/WebGraphQlTesterBuilderTests.java index cf0e5db9..9ed84e1c 100644 --- a/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/WebGraphQlTesterBuilderTests.java +++ b/spring-graphql-test/src/test/java/org/springframework/graphql/test/tester/WebGraphQlTesterBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 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. @@ -42,7 +42,7 @@ import org.springframework.graphql.server.webflux.GraphQlHttpHandler; import org.springframework.graphql.server.webflux.GraphQlWebSocketHandler; import org.springframework.graphql.support.DocumentSource; import org.springframework.http.codec.ClientCodecConfigurer; -import org.springframework.http.codec.json.Jackson2JsonDecoder; +import org.springframework.http.codec.json.JacksonJsonDecoder; import org.springframework.lang.Nullable; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.util.Assert; @@ -168,7 +168,7 @@ class WebGraphQlTesterBuilderTests { @MethodSource("argumentSource") void codecConfigurerRegistersJsonPathMappingProvider(TesterBuilderSetup builderSetup) { - TestJackson2JsonDecoder testDecoder = new TestJackson2JsonDecoder(); + TestJacksonJsonDecoder testDecoder = new TestJacksonJsonDecoder(); WebGraphQlTester.Builder builder = builderSetup.initBuilder() .codecConfigurer(codecConfigurer -> codecConfigurer.customCodecs().register(testDecoder)); @@ -267,7 +267,7 @@ class WebGraphQlTesterBuilderTests { } - private static class TestJackson2JsonDecoder extends Jackson2JsonDecoder { + private static class TestJacksonJsonDecoder extends JacksonJsonDecoder { @Nullable private Object lastValue; diff --git a/spring-graphql/build.gradle b/spring-graphql/build.gradle index 12b56d35..42c42249 100644 --- a/spring-graphql/build.gradle +++ b/spring-graphql/build.gradle @@ -32,7 +32,7 @@ dependencies { compileOnly "org.jetbrains.kotlin:kotlin-reflect" compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core' - compileOnly 'com.fasterxml.jackson.core:jackson-databind' + compileOnly 'tools.jackson.core:jackson-databind' compileOnly('com.apollographql.federation:federation-graphql-java-support') compileOnly('com.netflix.graphql.dgs.codegen:graphql-dgs-codegen-shared-core') { @@ -81,8 +81,7 @@ dependencies { testImplementation 'jakarta.persistence:jakarta.persistence-api' testImplementation 'jakarta.validation:jakarta.validation-api' testImplementation 'com.jayway.jsonpath:json-path' - testImplementation 'com.fasterxml.jackson.core:jackson-databind' - testImplementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310' + testImplementation 'tools.jackson.core:jackson-databind' testImplementation 'org.apache.tomcat.embed:tomcat-embed-el:10.0.21' testImplementation 'com.apollographql.federation:federation-graphql-java-support' @@ -93,7 +92,7 @@ dependencies { testFixturesApi 'org.springframework:spring-webflux' testFixturesApi 'org.junit.jupiter:junit-jupiter-engine' testFixturesApi 'com.squareup.okhttp3:mockwebserver' - testFixturesApi 'com.fasterxml.jackson.core:jackson-databind' + testFixturesApi 'tools.jackson.core:jackson-databind' } test { diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientBuilder.java b/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientBuilder.java index f05e7cc8..20cbaf2d 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientBuilder.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientBuilder.java @@ -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. @@ -33,8 +33,8 @@ import org.springframework.graphql.client.GraphQlClientInterceptor.SubscriptionC import org.springframework.graphql.support.CachingDocumentSource; import org.springframework.graphql.support.DocumentSource; import org.springframework.graphql.support.ResourceDocumentSource; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; +import org.springframework.http.codec.json.JacksonJsonDecoder; +import org.springframework.http.codec.json.JacksonJsonEncoder; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -55,8 +55,8 @@ import org.springframework.util.ClassUtils; */ public abstract class AbstractGraphQlClientBuilder> implements GraphQlClient.Builder { - protected static final boolean jackson2Present = ClassUtils.isPresent( - "com.fasterxml.jackson.databind.ObjectMapper", AbstractGraphQlClientBuilder.class.getClassLoader()); + protected static final boolean jacksonPresent = ClassUtils.isPresent( + "tools.jackson.databind.ObjectMapper", AbstractGraphQlClientBuilder.class.getClassLoader()); private final List interceptors = new ArrayList<>(); @@ -177,9 +177,9 @@ public abstract class AbstractGraphQlClientBuilder encoder() { - return new Jackson2JsonEncoder(); + return new JacksonJsonEncoder(); } static Decoder decoder() { - return new Jackson2JsonDecoder(); + return new JacksonJsonDecoder(); } } diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientSyncBuilder.java b/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientSyncBuilder.java index b969f39f..d8514e67 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientSyncBuilder.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/client/AbstractGraphQlClientSyncBuilder.java @@ -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,7 +35,7 @@ import org.springframework.graphql.support.CachingDocumentSource; import org.springframework.graphql.support.DocumentSource; import org.springframework.graphql.support.ResourceDocumentSource; import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.http.converter.json.JacksonJsonHttpMessageConverter; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -57,8 +57,8 @@ import org.springframework.util.ClassUtils; public abstract class AbstractGraphQlClientSyncBuilder> implements GraphQlClient.SyncBuilder { - protected static final boolean jackson2Present = ClassUtils.isPresent( - "com.fasterxml.jackson.databind.ObjectMapper", AbstractGraphQlClientSyncBuilder.class.getClassLoader()); + protected static final boolean jacksonPresent = ClassUtils.isPresent( + "tools.jackson.databind.ObjectMapper", AbstractGraphQlClientSyncBuilder.class.getClassLoader()); private final List interceptors = new ArrayList<>(); @@ -144,7 +144,7 @@ public abstract class AbstractGraphQlClientSyncBuilder initialize() { - return new MappingJackson2HttpMessageConverter(); + return new JacksonJsonHttpMessageConverter(); } } diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultRSocketGraphQlClientBuilder.java b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultRSocketGraphQlClientBuilder.java index 1b766e63..34ac4f17 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultRSocketGraphQlClientBuilder.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/client/DefaultRSocketGraphQlClientBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 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. @@ -69,11 +69,11 @@ final class DefaultRSocketGraphQlClientBuilder private static RSocketRequester.Builder initRSocketRequestBuilder() { RSocketRequester.Builder requesterBuilder = RSocketRequester.builder().dataMimeType(MimeTypeUtils.APPLICATION_JSON); - if (jackson2Present) { + if (jacksonPresent) { requesterBuilder.rsocketStrategies( RSocketStrategies.builder() - .encoder(DefaultJackson2Codecs.encoder()) - .decoder(DefaultJackson2Codecs.decoder()) + .encoder(DefaultJacksonCodecs.encoder()) + .decoder(DefaultJacksonCodecs.decoder()) .build()); } return requesterBuilder; diff --git a/spring-graphql/src/main/java/org/springframework/graphql/data/query/JsonKeysetCursorStrategy.java b/spring-graphql/src/main/java/org/springframework/graphql/data/query/JsonKeysetCursorStrategy.java index 75aff66f..907e94ec 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/data/query/JsonKeysetCursorStrategy.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/data/query/JsonKeysetCursorStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-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. @@ -22,9 +22,12 @@ import java.util.Collections; import java.util.Date; import java.util.Map; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.jsontype.BasicPolymorphicTypeValidator; -import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator; +import tools.jackson.databind.DefaultTyping; +import tools.jackson.databind.ObjectMapper; +import tools.jackson.databind.cfg.DateTimeFeature; +import tools.jackson.databind.json.JsonMapper; +import tools.jackson.databind.jsontype.BasicPolymorphicTypeValidator; +import tools.jackson.databind.jsontype.PolymorphicTypeValidator; import org.springframework.core.ResolvableType; import org.springframework.core.codec.Decoder; @@ -38,9 +41,8 @@ import org.springframework.http.codec.CodecConfigurer; import org.springframework.http.codec.DecoderHttpMessageReader; import org.springframework.http.codec.EncoderHttpMessageWriter; import org.springframework.http.codec.ServerCodecConfigurer; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; -import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; +import org.springframework.http.codec.json.JacksonJsonDecoder; +import org.springframework.http.codec.json.JacksonJsonEncoder; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.MimeTypeUtils; @@ -57,8 +59,8 @@ public final class JsonKeysetCursorStrategy implements CursorStrategy encoder; @@ -77,7 +79,7 @@ public final class JsonKeysetCursorStrategy implements CursorStrategy converter; + private final HttpMessageConverter converter; private final @Nullable Duration keepAliveDuration; @@ -117,7 +116,7 @@ public class GraphQlWebSocketHandler extends TextWebSocketHandler implements Sub * the WebSocket for the {@code "connection_ini"} message from the client. */ public GraphQlWebSocketHandler( - WebGraphQlHandler graphQlHandler, HttpMessageConverter converter, Duration connectionInitTimeout) { + WebGraphQlHandler graphQlHandler, HttpMessageConverter converter, Duration connectionInitTimeout) { this(graphQlHandler, converter, connectionInitTimeout, null); } @@ -133,7 +132,7 @@ public class GraphQlWebSocketHandler extends TextWebSocketHandler implements Sub * @since 1.3 */ public GraphQlWebSocketHandler( - WebGraphQlHandler graphQlHandler, HttpMessageConverter converter, + WebGraphQlHandler graphQlHandler, HttpMessageConverter converter, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration) { Assert.notNull(graphQlHandler, "WebGraphQlHandler is required"); @@ -289,10 +288,9 @@ public class GraphQlWebSocketHandler extends TextWebSocketHandler implements Sub } } - @SuppressWarnings("unchecked") private GraphQlWebSocketMessage decode(TextMessage message) throws IOException { - return ((GenericHttpMessageConverter) this.converter) - .read(GraphQlWebSocketMessage.class, null, new HttpInputMessageAdapter(message)); + return (GraphQlWebSocketMessage) this.converter + .read(GraphQlWebSocketMessage.class, new HttpInputMessageAdapter(message)); } private SessionState getSessionInfo(WebSocketSession session) { diff --git a/spring-graphql/src/test/java/org/springframework/graphql/JacksonJsonProvider.java b/spring-graphql/src/test/java/org/springframework/graphql/JacksonJsonProvider.java new file mode 100644 index 00000000..b77dc45a --- /dev/null +++ b/spring-graphql/src/test/java/org/springframework/graphql/JacksonJsonProvider.java @@ -0,0 +1,88 @@ +/* + * Copyright 2020-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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.graphql; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringWriter; +import java.util.LinkedHashMap; +import java.util.LinkedList; + +import com.jayway.jsonpath.InvalidJsonException; +import com.jayway.jsonpath.spi.json.AbstractJsonProvider; +import tools.jackson.core.JacksonException; +import tools.jackson.core.JsonGenerator; +import tools.jackson.databind.ObjectMapper; +import tools.jackson.databind.ObjectReader; + +/** + * {@link com.jayway.jsonpath.spi.json.JsonProvider} for Jackson 3.x. + * @author Brian Clozel + */ +class JacksonJsonProvider extends AbstractJsonProvider { + + private final ObjectMapper objectMapper = new ObjectMapper(); + + private final ObjectReader objectReader = this.objectMapper.reader(); + + @Override + public Object parse(String json) throws InvalidJsonException { + try { + return this.objectReader.readValue(json); + } + catch (JacksonException exc) { + throw new InvalidJsonException(exc, json); + } + } + + @Override + public Object parse(InputStream jsonStream, String charset) throws InvalidJsonException { + try { + return this.objectReader.readValue(new InputStreamReader(jsonStream, charset)); + } + catch (IOException exc) { + throw new InvalidJsonException(exc); + } + } + + @Override + public String toJson(Object obj) { + StringWriter writer = new StringWriter(); + try { + JsonGenerator generator = this.objectMapper.createGenerator(writer); + this.objectMapper.writeValue(generator, obj); + writer.flush(); + writer.close(); + generator.close(); + return writer.getBuffer().toString(); + } + catch (IOException exc) { + throw new InvalidJsonException(exc); + } + } + + @Override + public Object createArray() { + return new LinkedList(); + } + + @Override + public Object createMap() { + return new LinkedHashMap(); + } +} diff --git a/spring-graphql/src/test/java/org/springframework/graphql/JacksonMappingProvider.java b/spring-graphql/src/test/java/org/springframework/graphql/JacksonMappingProvider.java new file mode 100644 index 00000000..fd7962c7 --- /dev/null +++ b/spring-graphql/src/test/java/org/springframework/graphql/JacksonMappingProvider.java @@ -0,0 +1,65 @@ +/* + * Copyright 2020-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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.graphql; + +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.TypeRef; +import com.jayway.jsonpath.spi.mapper.MappingException; +import com.jayway.jsonpath.spi.mapper.MappingProvider; +import org.jspecify.annotations.Nullable; +import tools.jackson.databind.JavaType; +import tools.jackson.databind.ObjectMapper; + +/** + * {@link MappingProvider} for Jackson 3.x. + * @author Brian Clozel + */ +class JacksonMappingProvider implements MappingProvider { + + private final ObjectMapper objectMapper = new ObjectMapper(); + + @Override + public @Nullable T map(@Nullable Object source, Class targetType, Configuration configuration) { + if (source == null) { + return null; + } + try { + return this.objectMapper.convertValue(source, targetType); + } + catch (Exception exc) { + throw new MappingException(exc); + } + + } + + @Override + @SuppressWarnings("unchecked") + public @Nullable T map(@Nullable Object source, final TypeRef targetType, Configuration configuration) { + if (source == null) { + return null; + } + JavaType type = this.objectMapper.getTypeFactory().constructType(targetType.getType()); + + try { + return (T) this.objectMapper.convertValue(source, type); + } + catch (Exception exc) { + throw new MappingException(exc); + } + + } +} diff --git a/spring-graphql/src/test/java/org/springframework/graphql/ResponseHelper.java b/spring-graphql/src/test/java/org/springframework/graphql/ResponseHelper.java index fb77eb42..85a70998 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/ResponseHelper.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/ResponseHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 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. @@ -25,8 +25,6 @@ import com.jayway.jsonpath.Configuration; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.TypeRef; -import com.jayway.jsonpath.spi.json.JacksonJsonProvider; -import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; import graphql.ExecutionResult; import graphql.GraphQLError; import graphql.execution.ResultPath; diff --git a/spring-graphql/src/test/java/org/springframework/graphql/TestThreadLocalAccessor.java b/spring-graphql/src/test/java/org/springframework/graphql/TestThreadLocalAccessor.java index 75137aa7..3a6d09ca 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/TestThreadLocalAccessor.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/TestThreadLocalAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 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. @@ -17,8 +17,8 @@ package org.springframework.graphql; import io.micrometer.context.ThreadLocalAccessor; +import org.jspecify.annotations.Nullable; -import org.springframework.lang.Nullable; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-graphql/src/test/java/org/springframework/graphql/client/DefaultGraphQlClientResponseTests.java b/spring-graphql/src/test/java/org/springframework/graphql/client/DefaultGraphQlClientResponseTests.java index 85e6bcab..865e2ba5 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/client/DefaultGraphQlClientResponseTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/client/DefaultGraphQlClientResponseTests.java @@ -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. @@ -26,14 +26,15 @@ import graphql.GraphQLError; import graphql.GraphqlErrorBuilder; import graphql.execution.ResultPath; import graphql.language.SourceLocation; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.Test; import org.testcontainers.shaded.com.fasterxml.jackson.databind.DeserializationFeature; import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.graphql.ResponseError; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; -import org.springframework.lang.Nullable; +import org.springframework.http.codec.json.JacksonJsonDecoder; +import org.springframework.http.codec.json.JacksonJsonEncoder; + import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -184,7 +185,7 @@ class DefaultGraphQlClientResponseTests { return new DefaultClientGraphQlResponse( new DefaultClientGraphQlRequest("{test}", null, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap()), new ResponseMapGraphQlResponse(responseMap), - new Jackson2JsonEncoder(), new Jackson2JsonDecoder()); + new JacksonJsonEncoder(), new JacksonJsonDecoder()); } } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/client/HttpSyncGraphQlClientBuilderTests.java b/spring-graphql/src/test/java/org/springframework/graphql/client/HttpSyncGraphQlClientBuilderTests.java index 09e52158..2853dc33 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/client/HttpSyncGraphQlClientBuilderTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/client/HttpSyncGraphQlClientBuilderTests.java @@ -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. @@ -17,11 +17,11 @@ package org.springframework.graphql.client; import java.io.IOException; -import java.lang.reflect.Type; import java.net.URI; import java.util.Collections; import graphql.ExecutionResultImpl; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; @@ -41,9 +41,8 @@ import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.reactive.ClientHttpConnector; import org.springframework.http.converter.HttpMessageNotReadableException; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.http.converter.json.JacksonJsonHttpMessageConverter; import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.lang.Nullable; import org.springframework.mock.http.client.MockClientHttpRequest; import org.springframework.mock.http.client.MockClientHttpResponse; import org.springframework.test.web.reactive.server.HttpHandlerConnector; @@ -193,7 +192,7 @@ class HttpSyncGraphQlClientBuilderTests { @Test void codecConfigurerRegistersJsonPathMappingProvider() { - TestJackson2JsonConverter testConverter = new TestJackson2JsonConverter(); + TestJacksonJsonConverter testConverter = new TestJacksonJsonConverter(); HttpSyncGraphQlClient.Builder builder = this.setup.initBuilder(); builder.messageConverters(converters -> converters.add(0, testConverter)); @@ -295,7 +294,7 @@ class HttpSyncGraphQlClientBuilderTests { } - private static class TestJackson2JsonConverter extends MappingJackson2HttpMessageConverter { + private static class TestJacksonJsonConverter extends JacksonJsonHttpMessageConverter { @Nullable private Object lastValue; @@ -306,10 +305,8 @@ class HttpSyncGraphQlClientBuilderTests { } @Override - public Object read(Type type, Class contextClass, HttpInputMessage inputMessage) - throws IOException, HttpMessageNotReadableException { - - this.lastValue = super.read(type, contextClass, inputMessage); + protected Object readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { + this.lastValue = super.readInternal(clazz, inputMessage); return this.lastValue; } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/client/MockGraphQlWebSocketServer.java b/spring-graphql/src/test/java/org/springframework/graphql/client/MockGraphQlWebSocketServer.java index d086285d..a41f2d33 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/client/MockGraphQlWebSocketServer.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/client/MockGraphQlWebSocketServer.java @@ -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. @@ -24,6 +24,7 @@ import java.util.function.Function; import graphql.GraphQLError; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.jspecify.annotations.Nullable; import org.reactivestreams.Publisher; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -33,7 +34,6 @@ import org.springframework.graphql.GraphQlResponse; import org.springframework.graphql.server.support.GraphQlWebSocketMessage; import org.springframework.graphql.support.DefaultGraphQlRequest; import org.springframework.http.codec.ClientCodecConfigurer; -import org.springframework.lang.Nullable; import org.springframework.web.reactive.socket.WebSocketHandler; import org.springframework.web.reactive.socket.WebSocketSession; diff --git a/spring-graphql/src/test/java/org/springframework/graphql/client/MovieCharacter.java b/spring-graphql/src/test/java/org/springframework/graphql/client/MovieCharacter.java index a72d567e..a95e4b3b 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/client/MovieCharacter.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/client/MovieCharacter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 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. @@ -16,7 +16,8 @@ package org.springframework.graphql.client; -import org.springframework.lang.Nullable; +import org.jspecify.annotations.Nullable; + import org.springframework.util.ObjectUtils; diff --git a/spring-graphql/src/test/java/org/springframework/graphql/client/RSocketGraphQlClientBuilderTests.java b/spring-graphql/src/test/java/org/springframework/graphql/client/RSocketGraphQlClientBuilderTests.java index 97d39a65..bb629aae 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/client/RSocketGraphQlClientBuilderTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/client/RSocketGraphQlClientBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 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. @@ -25,6 +25,7 @@ import io.rsocket.SocketAcceptor; import io.rsocket.core.RSocketServer; import io.rsocket.transport.local.LocalClientTransport; import io.rsocket.transport.local.LocalServerTransport; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; @@ -33,9 +34,8 @@ import reactor.core.publisher.Mono; import org.springframework.graphql.GraphQlRequest; import org.springframework.graphql.execution.MockExecutionGraphQlService; import org.springframework.graphql.server.GraphQlRSocketHandler; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; -import org.springframework.lang.Nullable; +import org.springframework.http.codec.json.JacksonJsonDecoder; +import org.springframework.http.codec.json.JacksonJsonEncoder; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.rsocket.RSocketStrategies; import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler; @@ -108,7 +108,7 @@ class RSocketGraphQlClientBuilderTests { public RSocketGraphQlClient.Builder initBuilder() { GraphQlRSocketController controller = new GraphQlRSocketController( - new GraphQlRSocketHandler(this.graphQlService, Collections.emptyList(), new Jackson2JsonEncoder())); + new GraphQlRSocketHandler(this.graphQlService, Collections.emptyList(), new JacksonJsonEncoder())); this.server = RSocketServer.create() .acceptor(createSocketAcceptor(controller)) @@ -122,8 +122,8 @@ class RSocketGraphQlClientBuilderTests { private SocketAcceptor createSocketAcceptor(GraphQlRSocketController controller) { RSocketStrategies.Builder builder = RSocketStrategies.builder(); - builder.encoder(new Jackson2JsonEncoder()); - builder.decoder(new Jackson2JsonDecoder()); + builder.encoder(new JacksonJsonEncoder()); + builder.decoder(new JacksonJsonDecoder()); RSocketMessageHandler handler = new RSocketMessageHandler(); handler.setHandlers(Collections.singletonList(controller)); diff --git a/spring-graphql/src/test/java/org/springframework/graphql/client/RSocketGraphQlTransportTests.java b/spring-graphql/src/test/java/org/springframework/graphql/client/RSocketGraphQlTransportTests.java index fcd10732..ea80b3fd 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/client/RSocketGraphQlTransportTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/client/RSocketGraphQlTransportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 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. @@ -25,6 +25,7 @@ import io.rsocket.core.RSocketServer; import io.rsocket.exceptions.RejectedException; import io.rsocket.transport.local.LocalClientTransport; import io.rsocket.transport.local.LocalServerTransport; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; @@ -33,9 +34,8 @@ import reactor.test.StepVerifier; import org.springframework.graphql.GraphQlResponse; import org.springframework.graphql.ResponseError; import org.springframework.graphql.support.DefaultGraphQlRequest; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; -import org.springframework.lang.Nullable; +import org.springframework.http.codec.json.JacksonJsonDecoder; +import org.springframework.http.codec.json.JacksonJsonEncoder; import org.springframework.messaging.rsocket.RSocketRequester; import org.springframework.messaging.rsocket.RSocketStrategies; @@ -49,9 +49,9 @@ import static org.assertj.core.api.Assertions.assertThat; */ class RSocketGraphQlTransportTests { - private static final Jackson2JsonEncoder jsonEncoder = new Jackson2JsonEncoder(); + private static final JacksonJsonEncoder jsonEncoder = new JacksonJsonEncoder(); - private static final Jackson2JsonDecoder jsonDecoder = new Jackson2JsonDecoder(); + private static final JacksonJsonDecoder jsonDecoder = new JacksonJsonDecoder(); @Nullable diff --git a/spring-graphql/src/test/java/org/springframework/graphql/client/WebGraphQlClientBuilderTests.java b/spring-graphql/src/test/java/org/springframework/graphql/client/WebGraphQlClientBuilderTests.java index a70b84c1..b3e2d25e 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/client/WebGraphQlClientBuilderTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/client/WebGraphQlClientBuilderTests.java @@ -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. @@ -24,6 +24,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; import graphql.ExecutionResultImpl; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -42,9 +43,8 @@ import org.springframework.graphql.support.DocumentSource; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.codec.ClientCodecConfigurer; -import org.springframework.http.codec.json.Jackson2JsonDecoder; +import org.springframework.http.codec.json.JacksonJsonDecoder; import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.lang.Nullable; import org.springframework.test.web.reactive.server.HttpHandlerConnector; import org.springframework.util.Assert; import org.springframework.util.MimeType; @@ -212,7 +212,7 @@ class WebGraphQlClientBuilderTests { @MethodSource("argumentSource") void codecConfigurerRegistersJsonPathMappingProvider(ClientBuilderSetup setup) { - TestJackson2JsonDecoder testDecoder = new TestJackson2JsonDecoder(); + TestJacksonJsonDecoder testDecoder = new TestJacksonJsonDecoder(); WebGraphQlClient.Builder builder = setup.initBuilder(); builder.codecConfigurer(codecConfigurer -> codecConfigurer.customCodecs().register(testDecoder)); @@ -335,7 +335,7 @@ class WebGraphQlClientBuilderTests { } - private static class TestJackson2JsonDecoder extends Jackson2JsonDecoder { + private static class TestJacksonJsonDecoder extends JacksonJsonDecoder { @Nullable private Object lastValue; diff --git a/spring-graphql/src/test/java/org/springframework/graphql/data/GraphQlArgumentBinderTests.java b/spring-graphql/src/test/java/org/springframework/graphql/data/GraphQlArgumentBinderTests.java index 8cfffc78..710e8325 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/data/GraphQlArgumentBinderTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/data/GraphQlArgumentBinderTests.java @@ -29,10 +29,10 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.IntStream; -import com.fasterxml.jackson.databind.ObjectMapper; import graphql.schema.DataFetchingEnvironment; import graphql.schema.DataFetchingEnvironmentImpl; import org.junit.jupiter.api.Test; +import tools.jackson.databind.ObjectMapper; import org.springframework.core.MethodParameter; import org.springframework.core.ResolvableType; diff --git a/spring-graphql/src/test/java/org/springframework/graphql/data/method/annotation/support/ArgumentResolverTestSupport.java b/spring-graphql/src/test/java/org/springframework/graphql/data/method/annotation/support/ArgumentResolverTestSupport.java index 05ac73d9..0bd9f6a7 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/data/method/annotation/support/ArgumentResolverTestSupport.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/data/method/annotation/support/ArgumentResolverTestSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-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. @@ -20,11 +20,11 @@ package org.springframework.graphql.data.method.annotation.support; import java.lang.reflect.Method; import java.util.Map; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; import graphql.schema.DataFetchingEnvironment; import graphql.schema.DataFetchingEnvironmentImpl; +import tools.jackson.core.JacksonException; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.ObjectMapper; import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.MethodParameter; @@ -52,7 +52,7 @@ class ArgumentResolverTestSupport { return methodParam; } - protected DataFetchingEnvironment environment(String argumentsJson) throws JsonProcessingException { + protected DataFetchingEnvironment environment(String argumentsJson) throws JacksonException { Map arguments = this.mapper.readValue(argumentsJson, MAP_TYPE_REFERENCE); return DataFetchingEnvironmentImpl.newDataFetchingEnvironment().arguments(arguments).build(); } diff --git a/spring-graphql/src/test/java/org/springframework/graphql/data/method/annotation/support/SortMethodArgumentResolverTests.java b/spring-graphql/src/test/java/org/springframework/graphql/data/method/annotation/support/SortMethodArgumentResolverTests.java index 8429ef53..2b91670e 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/data/method/annotation/support/SortMethodArgumentResolverTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/data/method/annotation/support/SortMethodArgumentResolverTests.java @@ -65,7 +65,7 @@ class SortMethodArgumentResolverTests extends ArgumentResolverTestSupport { private void testResolver(Function resolveFunction) throws Exception { DataFetchingEnvironment environment = environment(""" - { "sortFields": ["firstName", "lastName", "id"], "sortDirection": "DESC"}" + { "sortFields": ["firstName", "lastName", "id"], "sortDirection": "DESC" } """); Sort sort = resolveFunction.apply(environment); diff --git a/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherReactiveMongoDbTests.java b/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherReactiveMongoDbTests.java index 20168c94..999d199d 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherReactiveMongoDbTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/data/query/mongo/QueryByExampleDataFetcherReactiveMongoDbTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2024 the original author or authors. + * Copyright 2020-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. @@ -25,6 +25,7 @@ import java.util.stream.Collectors; import com.mongodb.reactivestreams.client.MongoClients; import graphql.schema.DataFetcher; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.Test; import org.testcontainers.containers.MongoDBContainer; import org.testcontainers.junit.jupiter.Container; @@ -54,7 +55,6 @@ import org.springframework.graphql.server.WebGraphQlRequest; import org.springframework.graphql.server.WebGraphQlResponse; import org.springframework.graphql.support.DefaultGraphQlRequest; import org.springframework.http.HttpHeaders; -import org.springframework.lang.Nullable; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-graphql/src/test/java/org/springframework/graphql/server/GraphQlRSocketHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/server/GraphQlRSocketHandlerTests.java index ba058b28..c81ef259 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/server/GraphQlRSocketHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/server/GraphQlRSocketHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 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. @@ -36,7 +36,7 @@ import org.springframework.core.codec.Encoder; import org.springframework.graphql.ExecutionGraphQlService; import org.springframework.graphql.server.webflux.GraphQlWebSocketHandler; import org.springframework.graphql.support.DefaultExecutionGraphQlResponse; -import org.springframework.http.codec.json.Jackson2JsonEncoder; +import org.springframework.http.codec.json.JacksonJsonEncoder; import static org.assertj.core.api.Assertions.assertThat; @@ -48,7 +48,7 @@ class GraphQlRSocketHandlerTests { private static final Duration TIMEOUT = Duration.ofSeconds(5); - private final Encoder encoder = new Jackson2JsonEncoder(); + private final Encoder encoder = new JacksonJsonEncoder(); @Test diff --git a/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlHttpHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlHttpHandlerTests.java index afebaa18..32d020e7 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlHttpHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlHttpHandlerTests.java @@ -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. @@ -21,12 +21,12 @@ import java.util.Collections; import java.util.List; import java.util.Locale; -import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import reactor.test.StepVerifier; +import tools.jackson.databind.ObjectMapper; import org.springframework.core.codec.DataBufferEncoder; import org.springframework.core.io.buffer.DefaultDataBuffer; @@ -42,8 +42,8 @@ import org.springframework.http.codec.EncoderHttpMessageWriter; import org.springframework.http.codec.HttpMessageReader; import org.springframework.http.codec.HttpMessageWriter; import org.springframework.http.codec.ServerCodecConfigurer; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; +import org.springframework.http.codec.json.JacksonJsonDecoder; +import org.springframework.http.codec.json.JacksonJsonEncoder; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; import org.springframework.mock.http.server.reactive.MockServerHttpResponse; import org.springframework.mock.web.server.MockServerWebExchange; @@ -60,7 +60,7 @@ import static org.assertj.core.api.Assertions.assertThat; class GraphQlHttpHandlerTests { private static final List> MESSAGE_READERS = - List.of(new DecoderHttpMessageReader<>(new Jackson2JsonDecoder())); + List.of(new DecoderHttpMessageReader<>(new JacksonJsonDecoder())); private final GraphQlHttpHandler greetingHandler = GraphQlSetup.schemaContent("type Query { greeting: String }") @@ -184,8 +184,8 @@ class GraphQlHttpHandlerTests { ObjectMapper mapper = new ObjectMapper(); CodecConfigurer configurer = ServerCodecConfigurer.create(); - configurer.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(mapper)); - configurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(mapper)); + configurer.defaultCodecs().jacksonJsonDecoder(new JacksonJsonDecoder(mapper)); + configurer.defaultCodecs().jacksonJsonEncoder(new JacksonJsonEncoder(mapper)); byte[] bytes = "{\"query\": \"{showId}\"}".getBytes(StandardCharsets.UTF_8); Flux body = Flux.just(DefaultDataBufferFactory.sharedInstance.wrap(bytes)); @@ -230,7 +230,7 @@ class GraphQlHttpHandlerTests { @Override public List> messageWriters() { - return Collections.singletonList(new EncoderHttpMessageWriter<>(new Jackson2JsonEncoder())); + return Collections.singletonList(new EncoderHttpMessageWriter<>(new JacksonJsonEncoder())); } @Override diff --git a/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlSseHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlSseHandlerTests.java index 05f65ac9..0296b8a8 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlSseHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlSseHandlerTests.java @@ -34,7 +34,7 @@ import org.springframework.graphql.server.support.SerializableGraphQlRequest; import org.springframework.http.MediaType; import org.springframework.http.codec.HttpMessageWriter; import org.springframework.http.codec.ServerSentEventHttpMessageWriter; -import org.springframework.http.codec.json.Jackson2JsonEncoder; +import org.springframework.http.codec.json.JacksonJsonEncoder; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; import org.springframework.mock.http.server.reactive.MockServerHttpResponse; import org.springframework.mock.web.reactive.function.server.MockServerRequest; @@ -52,7 +52,7 @@ import static org.assertj.core.api.Assertions.assertThat; class GraphQlSseHandlerTests { private static final List> MESSAGE_WRITERS = - List.of(new ServerSentEventHttpMessageWriter(new Jackson2JsonEncoder())); + List.of(new ServerSentEventHttpMessageWriter(new JacksonJsonEncoder())); private static final DataFetcher SEARCH_DATA_FETCHER = env -> { String author = env.getArgument("author"); diff --git a/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlWebSocketHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlWebSocketHandlerTests.java index 31838e3a..3db45f8a 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlWebSocketHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/server/webflux/GraphQlWebSocketHandlerTests.java @@ -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. @@ -52,7 +52,7 @@ import org.springframework.graphql.server.WebSocketSessionInfo; import org.springframework.graphql.server.support.GraphQlWebSocketMessage; import org.springframework.graphql.server.support.GraphQlWebSocketMessageType; import org.springframework.http.codec.ServerCodecConfigurer; -import org.springframework.http.codec.json.Jackson2JsonDecoder; +import org.springframework.http.codec.json.JacksonJsonDecoder; import org.springframework.web.reactive.socket.CloseStatus; import org.springframework.web.reactive.socket.WebSocketMessage; @@ -67,7 +67,7 @@ import static org.springframework.graphql.server.support.GraphQlWebSocketMessage */ class GraphQlWebSocketHandlerTests extends WebSocketHandlerTestSupport { - private static final Jackson2JsonDecoder decoder = new Jackson2JsonDecoder(); + private static final JacksonJsonDecoder decoder = new JacksonJsonDecoder(); private static final Duration TIMEOUT = Duration.ofSeconds(5); diff --git a/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlHttpHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlHttpHandlerTests.java index 9aa659f5..f7d6443e 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlHttpHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlHttpHandlerTests.java @@ -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,7 @@ import graphql.execution.preparsed.persisted.ApolloPersistedQuerySupport; import graphql.execution.preparsed.persisted.InMemoryPersistedQueryCache; import jakarta.servlet.ServletException; import org.junit.jupiter.api.Test; -import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper; +import tools.jackson.databind.ObjectMapper; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.graphql.GraphQlSetup; @@ -40,7 +40,7 @@ import org.springframework.graphql.server.support.SerializableGraphQlRequest; import org.springframework.http.MediaType; import org.springframework.http.converter.ByteArrayHttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.http.converter.json.JacksonJsonHttpMessageConverter; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.web.servlet.function.AsyncServerResponse; @@ -58,7 +58,7 @@ import static org.assertj.core.api.Assertions.assertThatNoException; class GraphQlHttpHandlerTests { private static final List> MESSAGE_READERS = - List.of(new MappingJackson2HttpMessageConverter(), new ByteArrayHttpMessageConverter()); + List.of(new JacksonJsonHttpMessageConverter(), new ByteArrayHttpMessageConverter()); private final GraphQlHttpHandler greetingHandler = GraphQlSetup.schemaContent("type Query { greeting: String }") .queryFetcher("greeting", (env) -> "Hello").toHttpHandler(); @@ -145,7 +145,7 @@ class GraphQlHttpHandlerTests { WebGraphQlHandler webGraphQlHandler = GraphQlSetup.schemaContent("type Query { greeting: String }") .queryFetcher("greeting", (env) -> "Hello").toWebGraphQlHandler(); - GraphQlHttpHandler handler = new GraphQlHttpHandler(webGraphQlHandler, new MappingJackson2HttpMessageConverter()); + GraphQlHttpHandler handler = new GraphQlHttpHandler(webGraphQlHandler, new JacksonJsonHttpMessageConverter()); MockHttpServletRequest servletRequest = createServletRequest("{ greeting }", MediaTypes.APPLICATION_GRAPHQL_RESPONSE.toString()); ServerRequest request = ServerRequest.create(servletRequest, Collections.emptyList()); diff --git a/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlSseHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlSseHandlerTests.java index 2a70912b..9ed9fbf5 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlSseHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlSseHandlerTests.java @@ -39,7 +39,7 @@ import org.springframework.graphql.GraphQlSetup; import org.springframework.graphql.server.WebGraphQlHandler; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.http.converter.json.JacksonJsonHttpMessageConverter; import org.springframework.mock.web.MockAsyncContext; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -63,7 +63,7 @@ import static org.mockito.Mockito.mock; class GraphQlSseHandlerTests { private static final List> MESSAGE_READERS = - List.of(new MappingJackson2HttpMessageConverter()); + List.of(new JacksonJsonHttpMessageConverter()); private static final AtomicBoolean DATA_FETCHER_CANCELLED = new AtomicBoolean(); diff --git a/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlWebSocketHandlerTests.java b/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlWebSocketHandlerTests.java index 90a7f287..d1e489c9 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlWebSocketHandlerTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/server/webmvc/GraphQlWebSocketHandlerTests.java @@ -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. @@ -55,9 +55,8 @@ import org.springframework.graphql.server.support.GraphQlWebSocketMessage; import org.springframework.graphql.server.support.GraphQlWebSocketMessageType; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpInputMessage; -import org.springframework.http.converter.GenericHttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.http.converter.json.JacksonJsonHttpMessageConverter; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketMessage; @@ -73,7 +72,7 @@ import static org.springframework.graphql.server.support.GraphQlWebSocketMessage */ class GraphQlWebSocketHandlerTests extends WebSocketHandlerTestSupport { - private static final HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + private static final HttpMessageConverter converter = new JacksonJsonHttpMessageConverter(); private static final Duration TIMEOUT = Duration.ofSeconds(5); @@ -494,8 +493,7 @@ class GraphQlWebSocketHandlerTests extends WebSocketHandlerTestSupport { private GraphQlWebSocketMessage decode(WebSocketMessage message) { try { HttpInputMessageAdapter inputMessage = new HttpInputMessageAdapter((TextMessage) message); - return ((GenericHttpMessageConverter) converter) - .read(GraphQlWebSocketMessage.class, null, inputMessage); + return (GraphQlWebSocketMessage) converter.read(GraphQlWebSocketMessage.class, inputMessage); } catch (IOException ex) { throw new IllegalStateException(ex); diff --git a/spring-graphql/src/testFixtures/java/org/springframework/graphql/execution/MockExecutionGraphQlService.java b/spring-graphql/src/testFixtures/java/org/springframework/graphql/execution/MockExecutionGraphQlService.java index 37ad8025..67450b5c 100644 --- a/spring-graphql/src/testFixtures/java/org/springframework/graphql/execution/MockExecutionGraphQlService.java +++ b/spring-graphql/src/testFixtures/java/org/springframework/graphql/execution/MockExecutionGraphQlService.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 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. @@ -23,8 +23,6 @@ import java.util.Map; import java.util.function.Consumer; import java.util.stream.Stream; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import graphql.ExecutionInput; import graphql.ExecutionResult; import graphql.ExecutionResultImpl; @@ -32,6 +30,8 @@ import graphql.GraphQLError; import graphql.GraphqlErrorBuilder; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.ObjectMapper; import org.springframework.graphql.ExecutionGraphQlRequest; import org.springframework.graphql.ExecutionGraphQlResponse; @@ -175,7 +175,7 @@ public class MockExecutionGraphQlService implements ExecutionGraphQlService { try { return OBJECT_MAPPER.readValue(json, Map.class); } - catch (JsonProcessingException ex) { + catch (JacksonException ex) { throw new IllegalStateException(ex); } }