tdranv
tdranv

Reputation: 1340

Spring Boot with GraphQL - schema issue

I am playing around with GraphQL and Spring Boot, but I am stuck on this issue for a while now.

First, here is my build.gradle:

...
compile 'com.graphql-java-kickstart:graphql-spring-boot-starter:5.10.0'
compile group: 'com.graphql-java', name: 'graphql-java-tools', version: '5.2.4'
runtime 'com.graphql-java-kickstart:graphiql-spring-boot-starter:5.10.0'
...

I have an entity, lets say - Dog, a Repository, Service, Mutator and a Query for it. In /resources I have dogs.graphqls with the schema in there.

But for some reason, I cannot get the app to start. The error message reads: No graphql schema files found on classpath with location pattern '**/*.graphqls'. When i remove the dependency to com.graphql-java-kickstart:graphql-spring-boot-starter it starts, but does not find the schema.

Any ideas?

Upvotes: 1

Views: 6191

Answers (3)

tdranv
tdranv

Reputation: 1340

I changed out the kickstarter dependencies with these:

compile group: 'com.graphql-java', name: 'graphql-spring-boot-starter', version: '5.0.2'
compile group: 'com.graphql-java', name: 'graphql-java-tools', version: '5.2.4'
compile group: 'com.graphql-java', name: 'graphiql-spring-boot-starter', version: '3.0.3'

:|

Upvotes: 0

roop kumar r
roop kumar r

Reputation: 11

Include the following code in pom.xml:

<resources>
<resource>
    <directory>src/main/resources</directory>
    <includes>
        <include>**/*.properties</include>
        <include>**/*.graphqls</include>
    </includes>
</resource>

Upvotes: 1

Shadov
Shadov

Reputation: 5591

I have a GraphQL spring-boot project and I see 2 differences:

  • my schemas are in resources/graphql - probably doesn't matter
  • some other dependencies - I remember playing with those dependencies to fix similar problems to this

Have a look - https://github.com/xShadov/code-hellven/blob/master/core/api/pom.xml - try using similar dependencies (not sure how it translates to gradle):

<graphql.version>5.4.1</graphql.version>
<graphql-datetime-spring-boot-starter.version>1.4.0</graphql-datetime-spring-boot-starter.version>

<dependency>
  <groupId>com.graphql-java-kickstart</groupId>
  <artifactId>graphql-spring-boot-starter</artifactId>
  <version>${graphql.version}</version>
</dependency>
<dependency>
  <groupId>com.graphql-java-kickstart</groupId>
  <artifactId>graphiql-spring-boot-starter</artifactId>
  <version>${graphql.version}</version>
</dependency>
<dependency>
  <groupId>com.graphql-java-kickstart</groupId>
  <artifactId>voyager-spring-boot-starter</artifactId>
  <version>${graphql.version}</version>
</dependency>
<dependency>
  <groupId>com.graphql-java-kickstart</groupId>
  <artifactId>graphql-java-tools</artifactId>
  <version>${graphql.version}</version>
</dependency>
<dependency>
  <groupId>com.zhokhov.graphql</groupId>
  <artifactId>graphql-datetime-spring-boot-starter</artifactId>
  <version>${graphql-datetime-spring-boot-starter.version}</version>
</dependency>

Upvotes: 0

Related Questions