bug: Changed behaviour of spring.autoconfigure.exclude since com.netflix.graphql.dgs:graphql-dgs-spring-graphql-starter:8.5.4
edee111 opened this issue · 1 comments
I wanted to upgrade DGS to the latest version 9.1.2
. So I changed the dependency in Gradle:
- from
com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter:8.5.8
- to
com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter:9.1.2
But then when starting an application there is a deprecation warning in the log
DEPRECATION WARNING - This project is using the deprecated 'graphql-dgs-spring-boot-starter'. Please switch to 'graphql-dgs-spring-graphql-starter'. For more context: https://netflix.github.io/dgs/spring-graphql-integration
But when changing the dependency to com.netflix.graphql.dgs:graphql-dgs-spring-graphql-starter:9.1.2
, some unit tests stopped working. See the details bellow.
Expected behavior
When overriding the Spring Boot (SB) property spring.autoconfigure.exclude
e.g. in a unit test by the @TestProperties
annotation, the value set in the annotation should be present in the application context.
Actual behavior
Setting the spring.autoconfigure.exclude
e.g. in unit test by the @TestProperties
appends the value to the configuration property already defined e.g. in application.yaml
file. Does not override it.
Steps to reproduce
In this repository, the issue is reproduced.
Experiments in the repository show that:
- with
com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter
- the autoconfiguration exclusion behaves as expected
- with
com.netflix.graphql.dgs:graphql-dgs-spring-graphql-starter
- until DGS version 8.5.3 autoconfiguration exclusion behaves as expected
- since DGS version 8.5.4 autoconfiguration exclusion behavior changed
More info
I checked the commits between those two versions, and it seems that the cause of this new behavior could be the class com.netflix.graphql.dgs.springgraphql.autoconfig.ExcludeAutoConfigurationsEnvironmentPostProcessor
. It manipulates the spring.autoconfigure.exclude
property in some way. Also, this class is not present in com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter
but is present in com.netflix.graphql.dgs:graphql-dgs-spring-graphql-starter
which also supports my assumption.
In my project, I need to exclude some autoconfiguration for all unit tests, but in some cases, I want to keep it included and that is why I changed the spring.autoconfigure.exclude
just for a few tests out of thousands.