-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
@DynamicPropertySource is not supported via @NestedTestConfiguration semantics #26091
Comments
DynamicPropertySource
Thanks so much for raising the issue! When implementing #19930, my goal was to provide support for inheriting enclosing class configuration for all class-level annotations; however, I simply overlooked
So I apologize for missing that. I've already reproduced the issue in an integration test using only the Spring Framework, and the fix requires some changes in |
I've added support for inheriting This will be released with Spring Framework 5.3.2, but feel free to try it out in an upcoming snapshot. As a workaround for 5.3.0 and 5.3.1, you can create a test base class (typically |
… class Prior to this commit, a dynamic property registered via a @DynamicPropertySource method in a @nested test class was not able to override a property registered via a @DynamicPropertySource method in the enclosing class. See spring-projectsgh-26091 Closes spring-projectsgh-31083
Reproduced with Spring Framework 5.3.1 (via Spring Boot 2.4.0).
As initially described here and here, nested tests do not work with
@DynamicPropertySource
.You can reproduce the issue with this sample Spring Data JPA (2.4.1) repository: https://github.com/fbiville/spring-data-jpa-nested (see README for reproduction one-liners).
As suggested by @wilkinsona here, replacing the annotation with
ApplicationContextInitializer
works.The text was updated successfully, but these errors were encountered: