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:
-
Federation.transform(TypeDefinitionRegistry, RuntimeWiring)
-
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 TypeMethodDescriptionvoidcreateGraphQLSchema(TypeDefinitionRegistry registry, RuntimeWiring wiring) CreateGraphQLSchemaviaSchemaTransformer, setting up the "_entities"DataFetcherandTypeResolverfor federated types.com.apollographql.federation.graphqljava.SchemaTransformercreateSchemaTransformer(TypeDefinitionRegistry registry, RuntimeWiring wiring) Alternative tocreateGraphQLSchema(TypeDefinitionRegistry, RuntimeWiring)that allows calling additional methods onSchemaTransformer.protected HandlerMethodgetMappingInfo(Method method, Object handler, Class<?> handlerType) protected HandlerMethodArgumentResolverCompositevoidsetTypeResolver(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, createHandlerMethod, detectHandlerMethods, getApplicationContext, getArgumentResolvers, getConversionService, getExceptionResolver, getExecutor, isFallBackOnDirectFieldAccess, obtainApplicationContext, setApplicationContext, setBlockingMethodPredicate, setExecutor, setFallBackOnDirectFieldAccess, shouldInvokeAsync
-
Constructor Details
-
FederationSchemaFactory
public FederationSchemaFactory()
-
-
Method Details
-
setTypeResolver
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:
-
SchemaTransformer.resolveEntityType(TypeResolver)
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
initArgumentResolvers
- Specified by:
initArgumentResolversin classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
getMappingInfo
@Nullable protected FederationSchemaFactory.EntityMappingInfo getMappingInfo(Method method, Object handler, Class<?> handlerType) - Specified by:
getMappingInfoin classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
getHandlerMethod
- Specified by:
getHandlerMethodin classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
createGraphQLSchema
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(TypeDefinitionRegistry registry, RuntimeWiring wiring) Alternative tocreateGraphQLSchema(TypeDefinitionRegistry, RuntimeWiring)that allows calling additional methods onSchemaTransformer.- Parameters:
registry- the existing type definition registrywiring- the existing runtime wiring
-