Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

graphql-java-kickstart/graphql-spring-boot

 
 

Repository files navigation

Table of Contents

GraphQL and GraphiQL Spring Framework Boot Starters

Build Status Chat on Gitter

GraphQL Starter

Download

GraphiQL Starter

Download

Intro

Repository contains:

  • graphql-spring-boot-starter to turn your boot application into GraphQL server (see graphql-java-servlet)
  • graphiql-spring-boot-starterto embed GraphiQL tool for schema introspection and query debugging (see graphiql)

Requires

  • Java 1.8
  • Spring Framework Boot > 1.3.x (web)

Add repository:

repositories {
    // stable build
    jcenter()
    // development build
    maven { url  "http://dl.bintray.com/oembedler/maven" }
}

Dependency:

dependencies {
  compile 'com.embedler.moon.graphql.boot:graphql-spring-boot-starter:INSERT_LATEST_VERSION_HERE'
  
  // to embed GraphiQL tool
  compile 'com.embedler.moon.graphql.boot:graphiql-spring-boot-starter:INSERT_LATEST_VERSION_HERE'
}

How to use the latest build with Maven:

<repository>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
    <id>bintray-oembedler-maven</id>
    <name>bintray</name>
    <url>http://dl.bintray.com/oembedler/maven</url>
</repository>

Dependency:

<dependency>
    <groupId>com.embedler.moon.graphql.boot</groupId>
    <artifactId>graphql-spring-boot-starter</artifactId>
    <version>INSERT_LATEST_VERSION_HERE</version>
</dependency>

<!-- to embed GraphiQL tool -->
<dependency>
    <groupId>com.embedler.moon.graphql.boot</groupId>
    <artifactId>graphiql-spring-boot-starter</artifactId>
    <version>INSERT_LATEST_VERSION_HERE</version>
</dependency>

Enable GraphQL Server

Server becomes accessible at /graphql if graphql-spring-boot-starter added as a dependency to a boot application. A GraphQL schema is automatically discovered extracting classes from Spring context marked as @GraphQLSchema.

See the graphql-java-servlet usage docs for the avaiable endpoints exposed.

Available Spring Boot configuration parameters (either application.yml or application.properties):

graphql:
      servlet:
               mapping: /graphql
               enabled: true
               corsEnabled: true
               uploadMaxFileSize: 128KB
               uploadMaxRequestSize: 128KB

      spring-graphql-common:
               clientMutationIdName: clientMutationId
               injectClientMutationId: true
               allowEmptyClientMutationId: false
               mutationInputArgumentName: input
               outputObjectNamePrefix: Payload
               inputObjectNamePrefix: Input
               schemaMutationObjectName: Mutation

By default system enables global CORS filter for /graphql/** context. The corsEnabled can be set to false to disable it.

Enable GraphiQL Tool

GraphiQL becomes accessible at the root / if graphiql-spring-boot-starter added as a dependency to a boot application.

Note that GraphQL server must be available at /graphql context to be discovered by GraphiQL.

Contributions

Contributions are welcome.

Tips:

License

graphql-spring-boot-starter and graphiql-spring-boot-starter are licensed under the MIT License. See LICENSE for details.

spring-graphql-common License

graphql-java License

graphiql License

graphql-js License

About

GraphQL and GraphiQL Spring Framework Boot Starters - Forked from oembedler/graphql-spring-boot due to inactivity.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 97.2%
  • HTML 2.6%
  • Other 0.2%