javaspring-bootgraphqlspring-graphql

How to use multiple graphqls files?


I'm trying to build a GraphQL application, and my current schema files are located at the following paths:

schema/book/book.graphqls,
schema/infra/infra.graphqls

Right now In my properties file, I have this configuration:

spring.graphql.schema.locations=classpath*:schema/book

However, when I start my application, only the book schema is being recognized. I want to ensure that both the infra schema and any future schemas I add are also included.

I attempted the following configurations in my properties file, but neither worked : ( I encountered a Whitelabel Error Page )

spring.graphql.schema.locations=classpath*:schema/**/*.graphqls
spring.graphql.schema.locations=classpath:schema/**/*graphqls

Could you help me understand what I'm missing ?


Solution

  • You should point to the base location for all schema files and the scanning will look under all nested folders.

    spring.graphql.schema.locations=classpath:schema/