Merge branch '3.3.x'

Closes gh-43507
This commit is contained in:
Phillip Webb 2024-12-13 19:02:58 -08:00
commit 940ff952fa
1 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -243,8 +243,11 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
return ClassUtils.resolveClassName(foundClassName, testClass.getClassLoader());
}
Class<?> found = new AnnotatedClassFinder(SpringBootConfiguration.class).findFromClass(testClass);
Assert.state(found != null, "Unable to find a @SpringBootConfiguration, you need to use "
+ "@ContextConfiguration or @SpringBootTest(classes=...) with your test");
Assert.state(found != null,
"Unable to find a @SpringBootConfiguration by searching packages upwards from the test. "
+ "You can use @ContextConfiguration, @SpringBootTest(classes=...) or other Spring Test "
+ "supported mechanisms to explicitly declare the configuration classes to load. Classes "
+ "annotated with @TestConfiguration are not considered.");
this.aotTestAttributes.setAttribute(propertyName, found.getName());
return found;
}