Class FederationSchemaFactory
java.lang.Object
org.springframework.graphql.data.method.annotation.support.AnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
org.springframework.graphql.data.federation.FederationSchemaFactory
- All Implemented Interfaces:
Aware,InitializingBean,ApplicationContextAware
public final class FederationSchemaFactory
extends AnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
Detects
@EntityMapping handler methods on controllers
declared in Spring configuration, and provides factory methods to create
GraphQLSchema or SchemaTransformer.
This class is intended to be declared as a bean in Spring configuration,
and plugged in via GraphQlSource.SchemaResourceBuilder.schemaFactory(BiFunction).
- Since:
- 1.3.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.springframework.graphql.data.method.annotation.support.AnnotatedControllerDetectionSupport
logger, springSecurityPresent -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgraphql.schema.GraphQLSchemacreateGraphQLSchema(graphql.schema.idl.TypeDefinitionRegistry registry, graphql.schema.idl.RuntimeWiring wiring) CreateGraphQLSchemaviaSchemaTransformer, setting up the "_entities"DataFetcherandTypeResolverfor federated types.com.apollographql.federation.graphqljava.SchemaTransformercreateSchemaTransformer(graphql.schema.idl.TypeDefinitionRegistry registry, graphql.schema.idl.RuntimeWiring wiring) Alternative tocreateGraphQLSchema(TypeDefinitionRegistry, RuntimeWiring)that allows calling additional methods onSchemaTransformer.protected HandlerMethodprotected @Nullable FederationSchemaFactory.EntityMappingInfogetMappingInfo(Method method, Object handler, Class<?> handlerType) protected HandlerMethodArgumentResolverCompositevoidsetTypeResolver(@Nullable graphql.schema.TypeResolver typeResolver) Configure a resolver that helps to map Java to entity schema type names.Methods inherited from class org.springframework.graphql.data.method.annotation.support.AnnotatedControllerDetectionSupport
addFormatterRegistrar, configureBinder, createHandlerMethod, detectHandlerMethods, getApplicationContext, getArgumentResolvers, getBinderOptions, getConversionService, getExceptionResolver, getExecutor, isFallBackOnDirectFieldAccess, obtainApplicationContext, setApplicationContext, setBinderOptions, setBlockingMethodPredicate, setControllerPredicate, setExecutor, setFallBackOnDirectFieldAccess, shouldInvokeAsync
-
Constructor Details
-
FederationSchemaFactory
public FederationSchemaFactory()
-
-
Method Details
-
setTypeResolver
public void setTypeResolver(@Nullable graphql.schema.TypeResolver typeResolver) Configure a resolver that helps to map Java to entity schema type names.By default, this is
ClassNameTypeResolver.- Parameters:
typeResolver- the custom type resolver to use- See Also:
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
initArgumentResolvers
- Specified by:
initArgumentResolversin classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
getMappingInfo
protected @Nullable FederationSchemaFactory.EntityMappingInfo getMappingInfo(Method method, Object handler, Class<?> handlerType) - Specified by:
getMappingInfoin classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
getHandlerMethod
- Specified by:
getHandlerMethodin classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
createGraphQLSchema
public graphql.schema.GraphQLSchema createGraphQLSchema(graphql.schema.idl.TypeDefinitionRegistry registry, graphql.schema.idl.RuntimeWiring wiring) CreateGraphQLSchemaviaSchemaTransformer, setting up the "_entities"DataFetcherandTypeResolverfor federated types.Use this to supply a
schemaFactory.- Parameters:
registry- the existing type definition registrywiring- the existing runtime wiring
-
createSchemaTransformer
public com.apollographql.federation.graphqljava.SchemaTransformer createSchemaTransformer(graphql.schema.idl.TypeDefinitionRegistry registry, graphql.schema.idl.RuntimeWiring wiring) Alternative tocreateGraphQLSchema(TypeDefinitionRegistry, RuntimeWiring)that allows calling additional methods onSchemaTransformer.- Parameters:
registry- the existing type definition registrywiring- the existing runtime wiring
-