public final class WebApplicationContextRunner extends AbstractApplicationContextRunner<WebApplicationContextRunner,org.springframework.web.context.ConfigurableWebApplicationContext,AssertableWebApplicationContext>
ApplicationContext runner
for a Servlet
based ConfigurableWebApplicationContext
.
See AbstractApplicationContextRunner
for details.
Constructor and Description |
---|
WebApplicationContextRunner()
Create a new
WebApplicationContextRunner instance using an
AnnotationConfigWebApplicationContext with a MockServletContext as
the underlying source. |
WebApplicationContextRunner(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(Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> contextFactory,
List<org.springframework.context.ApplicationContextInitializer<? super org.springframework.web.context.ConfigurableWebApplicationContext>> initializers,
TestPropertyValues environmentProperties,
TestPropertyValues systemProperties,
ClassLoader classLoader,
org.springframework.context.ApplicationContext parent,
List<Configurations> configurations) |
static Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> |
withMockServletContext(Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> contextFactory)
Decorate the specified
contextFactory to set a MockServletContext
on each newly created WebApplicationContext . |
run, with, withClassLoader, withConfiguration, withInitializer, withParent, withPropertyValues, withSystemProperties, withUserConfiguration
public WebApplicationContextRunner()
WebApplicationContextRunner
instance using an
AnnotationConfigWebApplicationContext
with a MockServletContext
as
the underlying source.withMockServletContext(Supplier)
public WebApplicationContextRunner(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(Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> contextFactory, List<org.springframework.context.ApplicationContextInitializer<? super org.springframework.web.context.ConfigurableWebApplicationContext>> initializers, TestPropertyValues environmentProperties, TestPropertyValues systemProperties, ClassLoader classLoader, org.springframework.context.ApplicationContext parent, List<Configurations> configurations)
newInstance
in class AbstractApplicationContextRunner<WebApplicationContextRunner,org.springframework.web.context.ConfigurableWebApplicationContext,AssertableWebApplicationContext>
public static Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> withMockServletContext(Supplier<org.springframework.web.context.ConfigurableWebApplicationContext> contextFactory)
contextFactory
to set a MockServletContext
on each newly created WebApplicationContext
.contextFactory
- the context factory to decorateMockServletContext
Copyright © 2020 Pivotal Software, Inc.. All rights reserved.