8

I recently started working with graphql and found it very intriguing. Since most of my rest apps were in java, I decided to do a quick setup using the provided spring boot starter project by the graphql-java team. It comes with graph-iql autoconf spring setup, which makes it easier to query /graphql endpoint.

After spending a few good hours on the project setup in IDEA, I was able to run the graphql-sample-app. But I think my servlet is still not enabled, and only the graphiql endpoint is running, as the default query is returning 404.

This is application.yml:

spring: application: name: graphql-todo-app server: port: 9000 graphql: spring-graphql-common: clientMutationIdName: clientMutationId injectClientMutationId: true allowEmptyClientMutationId: false mutationInputArgumentName: input outputObjectNamePrefix: Payload inputObjectNamePrefix: Input schemaMutationObjectName: Mutation servlet: mapping: /graphql enabled: true corsEnabled: true graphiql: mapping: /graphiql enabled: true 

This is what my build.gradle file looks like:

buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } maven { url 'http://repo.spring.io/plugins-release' } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE") classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6" } } apply plugin: 'java' apply plugin: 'org.springframework.boot' repositories { jcenter() mavenCentral() } dependencies{ // compile(project(":graphql-spring-boot-starter")) // compile(project(":graphiql-spring-boot-starter")) compile 'com.graphql-java:graphql-spring-boot-starter:3.6.0' // to embed GraphiQL tool compile 'com.graphql-java:graphiql-spring-boot-starter:3.6.0' compile "com.embedler.moon.graphql:spring-graphql-common:$LIB_SPRING_GRAPHQL_COMMON_VER" compile("org.springframework.boot:spring-boot-starter-web") compile("org.springframework.boot:spring-boot-starter-actuator") testCompile("org.springframework.boot:spring-boot-starter-test") } jar.enabled = true uploadArchives.enabled = false bintrayUpload.enabled = false 

After running gradle build, I run the generated jar file from the terminal. This is what I get on localhost:

enter image description here

1
  • It's a little hard to tell what's going on without the full code, would you mind creating a sample project and throwing it up on github? Commented Aug 11, 2017 at 13:53

2 Answers 2

3

I had the same issue using Spring boot 2.0.0 (M6). Switching back to 1.5.8.RELEASE solved the problem. They're working on the issue, it will be released as soon as there is a non milestone release for Spring boot 2.x

https://github.com/graphql-java/graphql-spring-boot/issues/40

https://github.com/graphql-java/graphql-spring-boot/pull/36

Sign up to request clarification or add additional context in comments.

Comments

0

Change to version 1.5.9.RELEASE of the spring-boot-starter-stop and it worked for me

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.