Support detection and with test initializers
Relax `SpringBootTestContextBootstrapper` rules so that a test can specify an `ApplicationContextInitializer` and still have `@SpringBootConfiguration` detected. Prior to this commit detection would not occur because it's possible that an initializer _could_ register configuration. This scenario is actually quite unlikely to occur, certainly less likely than wanting to use an initializer in combination with auto-detection. Fixes gh-8483
This commit is contained in:
@@ -194,8 +194,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
|
||||
protected Class<?>[] getOrFindConfigurationClasses(
|
||||
MergedContextConfiguration mergedConfig) {
|
||||
Class<?>[] classes = mergedConfig.getClasses();
|
||||
if (containsNonTestComponent(classes) || mergedConfig.hasLocations()
|
||||
|| !mergedConfig.getContextInitializerClasses().isEmpty()) {
|
||||
if (containsNonTestComponent(classes) || mergedConfig.hasLocations()) {
|
||||
return classes;
|
||||
}
|
||||
Class<?> found = new SpringBootConfigurationFinder()
|
||||
|
||||
Reference in New Issue
Block a user