diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.java index 2756ead51c08..9b9c408d7a58 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.java @@ -25,8 +25,7 @@ import graphql.GraphQL; import graphql.execution.instrumentation.Instrumentation; -import graphql.schema.idl.RuntimeWiring.Builder; -import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility; +import graphql.introspection.Introspection; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -108,7 +107,7 @@ public GraphQlSource graphQlSource(ResourcePatternResolver resourcePatternResolv builder.inspectSchemaMappings(logger::info); } if (!properties.getSchema().getIntrospection().isEnabled()) { - builder.configureRuntimeWiring(this::enableIntrospection); + Introspection.enabledJvmWide(false); } builder.configureTypeDefinitions(new ConnectionTypeDefinitionConfigurer()); wiringConfigurers.orderedStream().forEach(builder::configureRuntimeWiring); @@ -116,10 +115,6 @@ public GraphQlSource graphQlSource(ResourcePatternResolver resourcePatternResolv return builder.build(); } - private Builder enableIntrospection(Builder wiring) { - return wiring.fieldVisibility(NoIntrospectionGraphqlFieldVisibility.NO_INTROSPECTION_FIELD_VISIBILITY); - } - private Resource[] resolveSchemaResources(ResourcePatternResolver resolver, String[] locations, String[] extensions) { List resources = new ArrayList<>(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfigurationTests.java index dd0f97c7a4a2..75a44a5ce596 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfigurationTests.java @@ -22,12 +22,12 @@ import graphql.GraphQL; import graphql.execution.instrumentation.ChainedInstrumentation; import graphql.execution.instrumentation.Instrumentation; +import graphql.introspection.Introspection; import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLOutputType; import graphql.schema.GraphQLSchema; import graphql.schema.idl.RuntimeWiring; import graphql.schema.visibility.DefaultGraphqlFieldVisibility; -import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility; import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -183,8 +183,7 @@ void shouldDisableFieldIntrospection() { this.contextRunner.withPropertyValues("spring.graphql.schema.introspection.enabled:false").run((context) -> { GraphQlSource graphQlSource = context.getBean(GraphQlSource.class); GraphQLSchema schema = graphQlSource.schema(); - assertThat(schema.getCodeRegistry().getFieldVisibility()) - .isInstanceOf(NoIntrospectionGraphqlFieldVisibility.class); + assertThat(Introspection.isEnabledJvmWide()).isFalse(); }); } diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 401e9b5eaacf..92b2dc6e090e 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -432,7 +432,7 @@ bom { ] } } - library("GraphQL Java", "21.3") { + library("GraphQL Java", "21.4") { prohibit { startsWith(["2018-", "2019-", "2020-", "2021-", "230521-"]) because "These are snapshots that we don't want to see"