Browse Source

Make getInitializers() a protected method

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

Closes gh-11457
pull/11812/merge
Phillip Webb 8 years ago
parent
commit
706aa7af59
  1. 14
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java

14
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 { @@ -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()) {

Loading…
Cancel
Save