Make getInitializers() a protected method

Update `SpringBootContextLoader` so that `getInitializers()` is now a
protected method for subclasses to override if necessary.

Closes gh-11457
This commit is contained in:
Phillip Webb 2018-02-01 12:24:11 -08:00
parent b50b9afd26
commit 706aa7af59
1 changed files with 13 additions and 1 deletions

View File

@ -192,7 +192,19 @@ public class SpringBootContextLoader extends AbstractContextLoader {
TestPropertySourceUtils.convertInlinedPropertiesToMap(array));
}
private List<ApplicationContextInitializer<?>> getInitializers(
/**
* Return the {@link ApplicationContextInitializer initializers} that will be applied
* to the context. By default this method will adapt {@link ContextCustomizer context
* customizers}, add {@link SpringApplication#getInitializers() application
* initializers} and add
* {@link MergedContextConfiguration#getContextInitializerClasses() initializers
* specified on the test}.
* @param config the source context configuration
* @param application the application instance
* @return the initializers to apply
* @since 2.0.0
*/
protected List<ApplicationContextInitializer<?>> getInitializers(
MergedContextConfiguration config, SpringApplication application) {
List<ApplicationContextInitializer<?>> initializers = new ArrayList<>();
for (ContextCustomizer contextCustomizer : config.getContextCustomizers()) {