diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java index 566252fdaf..36b7b0500d 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java @@ -192,7 +192,19 @@ public class SpringBootContextLoader extends AbstractContextLoader { TestPropertySourceUtils.convertInlinedPropertiesToMap(array)); } - private List> 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> getInitializers( MergedContextConfiguration config, SpringApplication application) { List> initializers = new ArrayList<>(); for (ContextCustomizer contextCustomizer : config.getContextCustomizers()) {