Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Changed behaviour of spring.autoconfigure.exclude since com.netflix.graphql.dgs:graphql-dgs-spring-graphql-starter:8.5.4 #2032

Closed
edee111 opened this issue Oct 11, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@edee111
Copy link

edee111 commented Oct 11, 2024

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.

@edee111 edee111 added the bug Something isn't working label Oct 11, 2024
@edee111
Copy link
Author

edee111 commented Nov 19, 2024

Any progress on this issue?

@PFlorians
Copy link

PFlorians commented Dec 6, 2024

Is anyone looking into this? I have also encountered this bahavior

@paulbakker
Copy link
Collaborator

Sorry for the late reply, we were pretty busy getting the 10.x release out.

Thanks for providing a test app @edee111, this made it very easy to look into this!
I think this PR is the appropriate fix: #2102, can you please review?

It would still fail your test but I think that's correct. The point is that we shouldn't re-introduce values from normal configuration if this was overridden in a test property source, but it should still add excluded for the autoconfigs we don't want from Spring GraphQL. Your test didn't account for that, but I think that's the correctbehavior?

@paulbakker
Copy link
Collaborator

Fixed with #2102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants