public final class WebApplicationContextRunner extends AbstractApplicationContextRunner<WebApplicationContextRunner,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(Supplier<ConfigurableWebApplicationContext> contextFactory)
Create a new
WebApplicationContextRunner instance using the specified
contextFactory as the underlying source. |
Modifier and Type | Method and Description |
---|---|
protected WebApplicationContextRunner |
newInstance(Supplier<ConfigurableWebApplicationContext> contextFactory,
List<ApplicationContextInitializer<? super ConfigurableWebApplicationContext>> initializers,
TestPropertyValues environmentProperties,
TestPropertyValues systemProperties,
ClassLoader classLoader,
ApplicationContext parent,
List<AbstractApplicationContextRunner.BeanRegistration<?>> beanRegistrations,
List<Configurations> configurations) |
static Supplier<ConfigurableWebApplicationContext> |
withMockServletContext(Supplier<ConfigurableWebApplicationContext> contextFactory)
Decorate the specified
contextFactory to set a MockServletContext
on each newly created WebApplicationContext . |
run, with, withBean, withBean, withBean, withBean, withClassLoader, withConfiguration, withInitializer, withParent, withPropertyValues, withSystemProperties, withUserConfiguration
public WebApplicationContextRunner()
WebApplicationContextRunner
instance using an
AnnotationConfigServletWebApplicationContext
with a
MockServletContext
as the underlying source.withMockServletContext(Supplier)
public WebApplicationContextRunner(Supplier<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(Supplier<ConfigurableWebApplicationContext> contextFactory, List<ApplicationContextInitializer<? super ConfigurableWebApplicationContext>> initializers, TestPropertyValues environmentProperties, TestPropertyValues systemProperties, ClassLoader classLoader, ApplicationContext parent, List<AbstractApplicationContextRunner.BeanRegistration<?>> beanRegistrations, List<Configurations> configurations)
public static Supplier<ConfigurableWebApplicationContext> withMockServletContext(Supplier<ConfigurableWebApplicationContext> contextFactory)
contextFactory
to set a MockServletContext
on each newly created WebApplicationContext
.contextFactory
- the context factory to decorateMockServletContext
Copyright © 2021 Pivotal Software, Inc.. All rights reserved.