java - Spring Boot 与 GraphQL - 架构问题

标签 java spring spring-boot graphql

我正在使用 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 ,其中包含架构。

但由于某种原因,我无法启动该应用程序。错误消息显示:在类路径上找不到位置模式为“**/*.graphqls”的 graphql 架构文件。当我删除对 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>

关于java - Spring Boot 与 GraphQL - 架构问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58571479/

相关文章:

java - 保留 Spring OAuth2RestTemplate 的刷新 token

spring-mvc - 如何在 Spring Boot 中调试 MVC Controller URL 映射?

java - 带有 EJB : No persistence provider 的 JPA

Spring:CustomizedTraceInterceptor 未被调用

java - Spring JPA 查询注释中的日期时间算术

java - 在运行时创建 Spring JPA 实体

java - 更新我的spring版本会阻止gradle解决spring-boot-starter

java - 我应该在交易系统中使用哪种数据结构?

java - 域最大值 - Choco 求解器

java - Hibernate EntityListeners - PrePersist 方法在持久调用之前修改模型 - 如果持久调用失败怎么办?