From 548b2167b049870179fa5449e1c755287e4c3720 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Fri, 6 Mar 2026 13:13:18 +0100 Subject: [PATCH] Simplify changes made in commit c2d0d292bd5 See gh-36390 --- .../support/AbstractTestContextBootstrapper.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java index 90036bafa91..d411acdb2fd 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java @@ -297,13 +297,12 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot // Ideally, we should be able to reuse the ContextLoader that was resolved // in buildDefaultMergedContextConfiguration(); however, since we have been // informed that some implementations of resolveContextLoader() mutate the - // state of the supplied ContextConfigurationAttributes to detect default - // configuration classes, we need to invoke resolveContextLoader() on the - // completeDefaultConfigAttributesList as well in order not to break such - // custom TestContextBootstrappers. - ContextLoader contextLoader = resolveContextLoader(testClass, completeDefaultConfigAttributesList); + // state of the supplied ContextConfigurationAttributes to register + // configuration classes, we need to supply null for the ContextLoader in + // the invocation of buildMergedContextConfiguration() in order not to break + // such custom TestContextBootstrappers. MergedContextConfiguration completeMergedConfig = buildMergedContextConfiguration( - testClass, completeDefaultConfigAttributesList, contextLoader, null, + testClass, completeDefaultConfigAttributesList, null, null, cacheAwareContextLoaderDelegate, false); if (!Arrays.equals(mergedConfig.getClasses(), completeMergedConfig.getClasses())) {