public final class WebApplicationContextRunner extends AbstractApplicationContextRunner<WebApplicationContextRunner,org.springframework.web.context.ConfigurableWebApplicationContext,AssertableWebApplicationContext>
ApplicationContext runner for a Servlet
based ConfigurableWebApplicationContext.
See AbstractApplicationContextRunner for details.
AbstractApplicationContextRunner.BeanRegistration<T>| Constructor and Description |
|---|
WebApplicationContextRunner()
Create a new
WebApplicationContextRunner instance using an
AnnotationConfigServletWebApplicationContext with a
MockServletContext as the underlying source. |
WebApplicationContextRunner(java.util.function.Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> contextFactory)
Create a new
WebApplicationContextRunner instance using the specified
contextFactory as the underlying source. |
| Modifier and Type | Method and Description |
|---|---|
protected WebApplicationContextRunner |
newInstance(java.util.function.Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> contextFactory,
boolean allowBeanDefinitionOverriding,
java.util.List<org.springframework.context.ApplicationContextInitializer<? super org.springframework.web.context.ConfigurableWebApplicationContext>> initializers,
TestPropertyValues environmentProperties,
TestPropertyValues systemProperties,
java.lang.ClassLoader classLoader,
org.springframework.context.ApplicationContext parent,
java.util.List<AbstractApplicationContextRunner.BeanRegistration<?>> beanRegistrations,
java.util.List<org.springframework.boot.context.annotation.Configurations> configurations) |
static java.util.function.Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> |
withMockServletContext(java.util.function.Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> contextFactory)
Decorate the specified
contextFactory to set a MockServletContext
on each newly created WebApplicationContext. |
run, with, withAllowBeanDefinitionOverriding, withBean, withBean, withBean, withBean, withClassLoader, withConfiguration, withInitializer, withParent, withPropertyValues, withSystemProperties, withUserConfigurationpublic WebApplicationContextRunner()
WebApplicationContextRunner instance using an
AnnotationConfigServletWebApplicationContext with a
MockServletContext as the underlying source.withMockServletContext(Supplier)public WebApplicationContextRunner(java.util.function.Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> contextFactory)
WebApplicationContextRunner instance using the specified
contextFactory as the underlying source.contextFactory - a supplier that returns a new instance on each callprotected WebApplicationContextRunner newInstance(java.util.function.Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> contextFactory, boolean allowBeanDefinitionOverriding, java.util.List<org.springframework.context.ApplicationContextInitializer<? super org.springframework.web.context.ConfigurableWebApplicationContext>> initializers, TestPropertyValues environmentProperties, TestPropertyValues systemProperties, java.lang.ClassLoader classLoader, org.springframework.context.ApplicationContext parent, java.util.List<AbstractApplicationContextRunner.BeanRegistration<?>> beanRegistrations, java.util.List<org.springframework.boot.context.annotation.Configurations> configurations)
newInstance in class AbstractApplicationContextRunner<WebApplicationContextRunner,org.springframework.web.context.ConfigurableWebApplicationContext,AssertableWebApplicationContext>public static java.util.function.Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> withMockServletContext(java.util.function.Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> contextFactory)
contextFactory to set a MockServletContext
on each newly created WebApplicationContext.contextFactory - the context factory to decorateMockServletContext