Class SpringContextBean
java.lang.Object
com.graphql_java_generator.client.SpringContextBean
This class
- Author:
- etienne-sf
-
Constructor Summary
ConstructorsConstructorDescriptionSpringContextBean(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.ApplicationContextRetrieves the Spring Application Context.static org.springframework.graphql.client.GraphQlClientgetGraphQlClient(String graphQLSchema, RequestType requestType) Retrieves theGraphQlClientSpring bean, associated with the given GraphQL suffix.static voidsetApplicationContext(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 theGraphQlClientSpring 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 theGraphQlClientcreated 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:
-