From 706aa7af59e9f5b0a6850ae0689b05c5199364a7 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 1 Feb 2018 12:24:11 -0800 Subject: [PATCH] Make getInitializers() a protected method Update `SpringBootContextLoader` so that `getInitializers()` is now a protected method for subclasses to override if necessary. Closes gh-11457 --- .../boot/test/context/SpringBootContextLoader.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 566252fdaf8..36b7b0500df 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()) {