Fix https://github.com/spring-projects/spring-boot/issues/37040

Comment From: sbrannen

Related Issues

  • 26091

Comment From: sbrannen

This has been merged into 6.0.x and main in 368036cab433e6f4b1dc1045725a2677e4400d70 and revised in 620a87bcbc966be0c71a3c66c78c5633936f66c8.

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.