Class SpringContextBean

java.lang.Object
com.graphql_java_generator.client.SpringContextBean

@Component public class SpringContextBean extends Object
This class
Author:
etienne-sf
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpringContextBean(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 Type
    Method
    Description
    static org.springframework.context.ApplicationContext
    Retrieves the Spring Application Context.
    static org.springframework.graphql.client.GraphQlClient
    getGraphQlClient(String graphQLSchema, RequestType requestType)
    Retrieves the GraphQlClient Spring bean, associated with the given GraphQL suffix.
    static void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
    Sets the Spring Application Context.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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, like AbstractGraphQLRequest.
  • 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 the GraphQlClient 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 the GraphQlClient created for the relevant server.
      Parameters:
      graphQLSchema - The GraphQL schema suffix, as defined in the plugin configuration
      requestType - The type of request is necessary, to retrieve the good GraphQlClient
      Returns: