Skip to content

Conversation

quaff
Copy link
Contributor

@quaff quaff commented Aug 21, 2023

@sbrannen sbrannen changed the title Allow overriding dynamic property from enclosing class in inner class Allow overriding dynamic property from enclosing class in @Nested test class Aug 21, 2023
@sbrannen sbrannen added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 21, 2023
@sbrannen sbrannen added this to the 6.0.12 milestone Aug 21, 2023
@sbrannen sbrannen changed the title Allow overriding dynamic property from enclosing class in @Nested test class @DynamicPropertySource in @Nested cannot override dynamic properties from enclosing class Aug 21, 2023
@sbrannen sbrannen changed the title @DynamicPropertySource in @Nested cannot override dynamic properties from enclosing class @DynamicPropertySource in @Nested test class cannot override dynamic properties from enclosing class Aug 21, 2023
@sbrannen sbrannen closed this in 368036c Aug 21, 2023
@sbrannen sbrannen added the status: backported An issue that has been backported to maintenance branches label Aug 21, 2023
sbrannen pushed a commit that referenced this pull request Aug 21, 2023
… 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 gh-26091 Closes gh-31083
sbrannen added a commit that referenced this pull request Aug 21, 2023
@sbrannen
Copy link
Member

This has been merged into 6.0.x and main in 368036c and revised in 620a87b.

This has also been backported to 5.3.x (see #31085).

Thanks for noticing the issue in the Spring Boot issue tracker, fixing it, and submitting the PR! 👍


Side note: after attempting to backport this to 5.3.x, I realized why I had never tested it in the first place. Static members in inner classes were not supported in Java until Java 16 with the introduction of records (see https://bugs.openjdk.org/browse/JDK-8254321), and we didn't start authoring tests in Java 17 until 6.0. Thus, I had to remove the DynamicPropertySourceOverridesEnclosingClassTests class on the 5.3.x branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: test Issues in the test module status: backported An issue that has been backported to maintenance branches type: bug A general bug

3 participants