Table of Contents
- GraphQL and GraphiQL Spring Framework Boot Starters
- Intro
- Requires
- Enable GraphQL Server
- Enable GraphiQL Tool
- Contributions
- License
GraphQL Starter
GraphiQL Starter
Repository contains:
graphql-spring-boot-starterto turn your boot application into GraphQL server (see graphql-java-servlet)graphiql-spring-boot-starterto embedGraphiQLtool for schema introspection and query debugging (see graphiql)
- 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>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: MutationBy default system enables global CORS filter for /graphql/** context.
The corsEnabled can be set to false to disable it.
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 are welcome.
Tips:
- Respect the Code of Conduct.
- Before opening an Issue to report a bug, please try the latest development version. It might happen that the problem is already solved.
- Please use Markdown to format your comments properly. If you are not familiar with that: Getting started with writing and formatting on GitHub
- For Pull Requests:
- Here are some general tips
- Please be a as focused and clear as possible and don't mix concerns. This includes refactorings mixed with bug-fixes/features, see Open Source Contribution Etiquette
- It would be good to add an automatic test(s).
graphql-spring-boot-starter and graphiql-spring-boot-starter are licensed under the MIT License. See LICENSE for details.