【发布时间】:2022-02-25 18:11:59
【问题描述】:
我正在尝试使用 GraphQL 在 spring-boot 上运行空项目,但出现以下错误。
2022-01-03 12:33:11.440 ERROR 12944 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Could not find any GraphQL schema file under configured locations.
Action:
Check that the following locations contain schema files:
- '' (classpath:graphql/**/)
依赖关系:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-graphql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
方案:/resources/schema.graphqls:
type Query {
bookById(id: ID): Book
}
type Book {
id: ID
name: String
pageCount: Int
author: Author
}
type Author {
id: ID
firstName: String
lastName: String
}
有没有配置错误?
【问题讨论】:
-
错误消息告诉你 Spring GraphQL 在
graphql/目录下的类路径中查找模式文件。将架构文件移动到src/main/resources/graphql/目录。
标签: java spring-boot graphql