Merge branch '3.2.x'

Closes gh-40016
This commit is contained in:
Brian Clozel 2024-03-19 11:52:27 +01:00
commit e3f8c34b9b
3 changed files with 5 additions and 11 deletions

View File

@ -25,8 +25,7 @@ import java.util.concurrent.Executor;
import graphql.GraphQL; import graphql.GraphQL;
import graphql.execution.instrumentation.Instrumentation; import graphql.execution.instrumentation.Instrumentation;
import graphql.schema.idl.RuntimeWiring.Builder; import graphql.introspection.Introspection;
import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -108,7 +107,7 @@ public class GraphQlAutoConfiguration {
builder.inspectSchemaMappings(logger::info); builder.inspectSchemaMappings(logger::info);
} }
if (!properties.getSchema().getIntrospection().isEnabled()) { if (!properties.getSchema().getIntrospection().isEnabled()) {
builder.configureRuntimeWiring(this::enableIntrospection); Introspection.enabledJvmWide(false);
} }
builder.configureTypeDefinitions(new ConnectionTypeDefinitionConfigurer()); builder.configureTypeDefinitions(new ConnectionTypeDefinitionConfigurer());
wiringConfigurers.orderedStream().forEach(builder::configureRuntimeWiring); wiringConfigurers.orderedStream().forEach(builder::configureRuntimeWiring);
@ -116,10 +115,6 @@ public class GraphQlAutoConfiguration {
return builder.build(); return builder.build();
} }
private Builder enableIntrospection(Builder wiring) {
return wiring.fieldVisibility(NoIntrospectionGraphqlFieldVisibility.NO_INTROSPECTION_FIELD_VISIBILITY);
}
private Resource[] resolveSchemaResources(ResourcePatternResolver resolver, String[] locations, private Resource[] resolveSchemaResources(ResourcePatternResolver resolver, String[] locations,
String[] extensions) { String[] extensions) {
List<Resource> resources = new ArrayList<>(); List<Resource> resources = new ArrayList<>();

View File

@ -22,12 +22,12 @@ import java.util.concurrent.Executor;
import graphql.GraphQL; import graphql.GraphQL;
import graphql.execution.instrumentation.ChainedInstrumentation; import graphql.execution.instrumentation.ChainedInstrumentation;
import graphql.execution.instrumentation.Instrumentation; import graphql.execution.instrumentation.Instrumentation;
import graphql.introspection.Introspection;
import graphql.schema.GraphQLObjectType; import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLOutputType; import graphql.schema.GraphQLOutputType;
import graphql.schema.GraphQLSchema; import graphql.schema.GraphQLSchema;
import graphql.schema.idl.RuntimeWiring; import graphql.schema.idl.RuntimeWiring;
import graphql.schema.visibility.DefaultGraphqlFieldVisibility; import graphql.schema.visibility.DefaultGraphqlFieldVisibility;
import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility;
import org.assertj.core.api.InstanceOfAssertFactories; import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -183,8 +183,7 @@ class GraphQlAutoConfigurationTests {
this.contextRunner.withPropertyValues("spring.graphql.schema.introspection.enabled:false").run((context) -> { this.contextRunner.withPropertyValues("spring.graphql.schema.introspection.enabled:false").run((context) -> {
GraphQlSource graphQlSource = context.getBean(GraphQlSource.class); GraphQlSource graphQlSource = context.getBean(GraphQlSource.class);
GraphQLSchema schema = graphQlSource.schema(); GraphQLSchema schema = graphQlSource.schema();
assertThat(schema.getCodeRegistry().getFieldVisibility()) assertThat(Introspection.isEnabledJvmWide()).isFalse();
.isInstanceOf(NoIntrospectionGraphqlFieldVisibility.class);
}); });
} }

View File

@ -432,7 +432,7 @@ bom {
] ]
} }
} }
library("GraphQL Java", "21.3") { library("GraphQL Java", "21.4") {
prohibit { prohibit {
startsWith(["2018-", "2019-", "2020-", "2021-", "230521-"]) startsWith(["2018-", "2019-", "2020-", "2021-", "230521-"])
because "These are snapshots that we don't want to see" because "These are snapshots that we don't want to see"