Use MergedContextConfiguration.hasResources()

Simplify the code by using MergedContextConfiguration.hasResources().

See gh-49504
This commit is contained in:
Sam Brannen
2026-03-09 17:01:38 +00:00
committed by Andy Wilkinson
parent c49ebaa970
commit 7306fd04de
@@ -153,9 +153,7 @@ public class SpringBootContextLoader extends AbstractContextLoader implements Ao
}
private void assertHasClassesOrLocations(MergedContextConfiguration mergedConfig) {
boolean hasClasses = !ObjectUtils.isEmpty(mergedConfig.getClasses());
boolean hasLocations = !ObjectUtils.isEmpty(mergedConfig.getLocations());
Assert.state(hasClasses || hasLocations,
Assert.state(mergedConfig.hasResources(),
() -> "No configuration classes or locations found in @SpringApplicationConfiguration. "
+ "For default configuration detection to work you need Spring 4.0.3 or better (found "
+ SpringVersion.getVersion() + ").");