Description
Version
Spring Boot 2.7.1
Description
We created a new itest
source set in Gradle and when we run the test using @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
, seems like the autoconfigure GraphQL components are not provisioned.
How to reproduce it
This project contains a pretty simple GraphQL controller, with two tests:
- One inside the
test
source set, using RestAssured to call the GraphQL endpoint, which works fine (HTTP 200) - One inside the
itest
source set, using RestAssured to call the GraphQL endpoint, which doesn't work (HTTP 404)
Clues
I did some debugging and found that ConditionalOnGraphQlSchema
returns true for the test
source set, and false for the itest
source set, it seems like this line on DefaultGraphQlSchemaCondition
cannot find the GraphQL schema, and therefore, Spring Boot doesn't contribute the Graphql autoconfiguration.
My guess is this issue might be for Spring Boot and not Gradle configuration, as other resources work fine, like liquibase changelogs and application.yml files.