Class SpringContextBean
java.lang.Object
com.graphql_java_generator.client.SpringContextBean
This class
- Author:
- etienne-sf
-
Constructor Summary
ConstructorDescriptionSpringContextBean
(org.springframework.context.ApplicationContext applicationContext) Builds the Bean with the Spring Application Context, which is stored into a static attribute of the class. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.context.ApplicationContext
Retrieves the Spring Application Context.static org.springframework.graphql.client.GraphQlClient
getGraphQlClient
(String graphQLSchema, RequestType requestType) Retrieves theGraphQlClient
Spring bean, associated with the given GraphQL suffix.static void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) Sets the Spring Application Context.
-
Constructor Details
-
SpringContextBean
@Autowired public SpringContextBean(org.springframework.context.ApplicationContext applicationContext) Builds the Bean with the Spring Application Context, which is stored into a static attribute of the class. This allows to provide a the Spring IoC container to non-spring classes, likeAbstractGraphQLRequest
.
-
-
Method Details
-
getApplicationContext
public static org.springframework.context.ApplicationContext getApplicationContext()Retrieves the Spring Application Context. This method allows to connect a non-spring class to the Spring IoC container.- Returns:
-
setApplicationContext
public static void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) Sets the Spring Application Context. This method allows to provide a the Spring IoC container to non-spring classes.
Spring uses the Autowired constructor. This method is used by unit tests. -
getGraphQlClient
public static org.springframework.graphql.client.GraphQlClient getGraphQlClient(String graphQLSchema, RequestType requestType) Retrieves theGraphQlClient
Spring bean, associated with the given GraphQL suffix. The GraphQL suffix is defined in the plugin configuration. By default, it is an empty string. It becomes mandatory when the client connects to two GraphQl servers or more: it allows to select theGraphQlClient
created for the relevant server.- Parameters:
graphQLSchema
- The GraphQL schema suffix, as defined in the plugin configurationrequestType
- The type of request is necessary, to retrieve the goodGraphQlClient
- Returns:
-