[英]Spring Boot with GraphQL - schema issue
我正在玩 GraphQL 和 Spring Boot,但我在这个问题上停留了一段时间。
首先,这是我的 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'
...
我有一个实体,可以说 - Dog、一个存储库、服务、Mutator 和一个查询。 在 /resources 我有dogs.graphqls
与那里的模式。
但由于某种原因,我无法启动该应用程序。 错误消息显示: No graphql schema files found on classpath with location pattern '**/*.graphqls'
。 当我删除对com.graphql-java-kickstart:graphql-spring-boot-starter
的依赖项时,它会启动,但找不到架构。
有任何想法吗?
在 pom.xml 中包含以下代码:
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.graphqls</include>
</includes>
</resource>
我有一个 GraphQL spring-boot 项目,我看到 2 个不同之处:
resources/graphql
- 可能没关系看看 - https://github.com/xShadov/code-hellven/blob/master/core/api/pom.xml - 尝试使用类似的依赖项(不确定它如何转换为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>
我用这些改变了 kickstarter 依赖项:
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'
:|
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.