我正在使用 Netflix DGS GraphQL 库开发 POC,它要求架构默认位于 main/resources/schema/*.graphqls 中。但是,当我尝试构建本机映像时,spring/dgs 抱怨无法找到资源文件。
我知道要添加资源文件,我可以使用:
@ResourceHint(patterns = "resources/schema/schema.graphqls")
但是显然,由于以下错误,这不起作用。我无法在网上找到太多关于构建此原生映像如何以不同方式放置资源的信息,因此将不胜感激任何见解或反馈。
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dgsQueryExecutor': Unsatisfied dependency expressed through method 'dgsQueryExecutor' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schema': Unexpected exception during bean creation; nested exception is com.netflix.graphql.dgs.exceptions.NoSchemaFoundException: No schema files found. Define schemas in src/main/resources/schema/*.graphqls
我可以将 Netflix DGS 配置为在不同的目录中查找架构,但知道目录是什么是问题所在。
我的项目设置如下:
-src
-main
-java
-com.example.app
DemoApplication.java
-resources
-schema
-schema.graphqls