Upgrade to Spring for GraphQL 1.4.0-SNAPSHOT

See gh-45029
This commit is contained in:
Brian Clozel
2025-04-08 09:34:00 +02:00
parent 4cbf9312ad
commit d5460697b4
3 changed files with 19 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 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.
@@ -30,6 +30,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.Bean;
import org.springframework.graphql.execution.GraphQlSource;
import org.springframework.graphql.observation.DataFetcherObservationConvention;
import org.springframework.graphql.observation.DataLoaderObservationConvention;
import org.springframework.graphql.observation.ExecutionRequestObservationConvention;
import org.springframework.graphql.observation.GraphQlObservationInstrumentation;
@@ -49,9 +50,10 @@ public class GraphQlObservationAutoConfiguration {
@ConditionalOnMissingBean
public GraphQlObservationInstrumentation graphQlObservationInstrumentation(ObservationRegistry observationRegistry,
ObjectProvider<ExecutionRequestObservationConvention> executionConvention,
ObjectProvider<DataFetcherObservationConvention> dataFetcherConvention) {
ObjectProvider<DataFetcherObservationConvention> dataFetcherConvention,
ObjectProvider<DataLoaderObservationConvention> dataLoaderObservationConvention) {
return new GraphQlObservationInstrumentation(observationRegistry, executionConvention.getIfAvailable(),
dataFetcherConvention.getIfAvailable());
dataFetcherConvention.getIfAvailable(), dataLoaderObservationConvention.getIfAvailable());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 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.
@@ -25,6 +25,7 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.graphql.observation.DefaultDataFetcherObservationConvention;
import org.springframework.graphql.observation.DefaultDataLoaderObservationConvention;
import org.springframework.graphql.observation.DefaultExecutionRequestObservationConvention;
import org.springframework.graphql.observation.GraphQlObservationInstrumentation;
import org.springframework.graphql.server.WebGraphQlHandler;
@@ -71,6 +72,8 @@ class GraphQlObservationAutoConfigurationTests {
.isInstanceOf(CustomExecutionRequestObservationConvention.class);
assertThat(instrumentation).extracting("dataFetcherObservationConvention")
.isInstanceOf(CustomDataFetcherObservationConvention.class);
assertThat(instrumentation).extracting("dataLoaderObservationConvention")
.isInstanceOf(CustomDataLoaderObservationConvention.class);
});
}
@@ -97,6 +100,11 @@ class GraphQlObservationAutoConfigurationTests {
return new CustomDataFetcherObservationConvention();
}
@Bean
CustomDataLoaderObservationConvention customDataLoaderConvention() {
return new CustomDataLoaderObservationConvention();
}
}
static class CustomExecutionRequestObservationConvention extends DefaultExecutionRequestObservationConvention {
@@ -107,6 +115,10 @@ class GraphQlObservationAutoConfigurationTests {
}
static class CustomDataLoaderObservationConvention extends DefaultDataLoaderObservationConvention {
}
@Configuration(proxyBeanMethods = false)
static class WebGraphQlConfiguration {

View File

@@ -2227,7 +2227,7 @@ bom {
releaseNotes("https://github.com/spring-projects/spring-framework/releases/tag/v{version}")
}
}
library("Spring GraphQL", "1.4.0-M1") {
library("Spring GraphQL", "1.4.0-SNAPSHOT") {
considerSnapshots()
group("org.springframework.graphql") {
modules = [