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
-
Field Summary
Fields inherited from class org.springframework.graphql.data.method.annotation.support.AnnotatedControllerDetectionSupport
logger, springSecurityPresent
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
createGraphQLSchema
(TypeDefinitionRegistry registry, RuntimeWiring wiring) CreateGraphQLSchema
viaSchemaTransformer
, setting up the "_entities"DataFetcher
andTypeResolver
for federated types.com.apollographql.federation.graphqljava.SchemaTransformer
createSchemaTransformer
(TypeDefinitionRegistry registry, RuntimeWiring wiring) Alternative tocreateGraphQLSchema(TypeDefinitionRegistry, RuntimeWiring)
that allows calling additional methods onSchemaTransformer
.protected HandlerMethod
getMappingInfo
(Method method, Object handler, Class<?> handlerType) protected HandlerMethodArgumentResolverComposite
void
setTypeResolver
(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:
afterPropertiesSet
in interfaceInitializingBean
- Overrides:
afterPropertiesSet
in classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
initArgumentResolvers
- Specified by:
initArgumentResolvers
in classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
getMappingInfo
@Nullable protected FederationSchemaFactory.EntityMappingInfo getMappingInfo(Method method, Object handler, Class<?> handlerType) - Specified by:
getMappingInfo
in classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
getHandlerMethod
- Specified by:
getHandlerMethod
in classAnnotatedControllerDetectionSupport<FederationSchemaFactory.EntityMappingInfo>
-
createGraphQLSchema
CreateGraphQLSchema
viaSchemaTransformer
, setting up the "_entities"DataFetcher
andTypeResolver
for 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
-