类 WebApplicationContextRunner
java.lang.Object
org.springframework.boot.test.context.runner.AbstractApplicationContextRunner<WebApplicationContextRunner,ConfigurableWebApplicationContext,AssertableWebApplicationContext>
org.springframework.boot.test.context.runner.WebApplicationContextRunner
public final class WebApplicationContextRunner
extends AbstractApplicationContextRunner<WebApplicationContextRunner,ConfigurableWebApplicationContext,AssertableWebApplicationContext>
An
ApplicationContext runner
for a Servlet
based ConfigurableWebApplicationContext
.
See AbstractApplicationContextRunner
for details.
- 从以下版本开始:
- 2.0.0
- 作者:
- Andy Wilkinson, Stephane Nicoll, Phillip Webb
-
嵌套类概要
从类继承的嵌套类/接口 org.springframework.boot.test.context.runner.AbstractApplicationContextRunner
AbstractApplicationContextRunner.BeanRegistration<T>, AbstractApplicationContextRunner.RunnerConfiguration<C extends ConfigurableApplicationContext>
-
构造器概要
构造器构造器说明Create a newWebApplicationContextRunner
instance using anAnnotationConfigServletWebApplicationContext
with aMockServletContext
as the underlying source.WebApplicationContextRunner
(Supplier<ConfigurableWebApplicationContext> contextFactory) Create a newWebApplicationContextRunner
instance using the specifiedcontextFactory
as the underlying source.WebApplicationContextRunner
(Supplier<ConfigurableWebApplicationContext> contextFactory, Class<?>... additionalContextInterfaces) Create a newWebApplicationContextRunner
instance using the specifiedcontextFactory
as the underlying source. -
方法概要
修饰符和类型方法说明withMockServletContext
(Supplier<ConfigurableWebApplicationContext> contextFactory) Decorate the specifiedcontextFactory
to set aMockServletContext
on each newly createdWebApplicationContext
.从类继承的方法 org.springframework.boot.test.context.runner.AbstractApplicationContextRunner
prepare, run, with, withAllowBeanDefinitionOverriding, withAllowCircularReferences, withBean, withBean, withBean, withBean, withClassLoader, withConfiguration, withInitializer, withParent, withPropertyValues, withSystemProperties, withUserConfiguration
-
构造器详细资料
-
WebApplicationContextRunner
public WebApplicationContextRunner()Create a newWebApplicationContextRunner
instance using anAnnotationConfigServletWebApplicationContext
with aMockServletContext
as the underlying source.- 另请参阅:
-
WebApplicationContextRunner
Create a newWebApplicationContextRunner
instance using the specifiedcontextFactory
as the underlying source.- 参数:
contextFactory
- a supplier that returns a new instance on each call be added to the application context proxy
-
WebApplicationContextRunner
public WebApplicationContextRunner(Supplier<ConfigurableWebApplicationContext> contextFactory, Class<?>... additionalContextInterfaces) Create a newWebApplicationContextRunner
instance using the specifiedcontextFactory
as the underlying source.- 参数:
contextFactory
- a supplier that returns a new instance on each calladditionalContextInterfaces
- any additional application context interfaces to be added to the application context proxy- 从以下版本开始:
- 3.4.0
-
-
方法详细资料
-
withMockServletContext
public static Supplier<ConfigurableWebApplicationContext> withMockServletContext(Supplier<ConfigurableWebApplicationContext> contextFactory) Decorate the specifiedcontextFactory
to set aMockServletContext
on each newly createdWebApplicationContext
.- 参数:
contextFactory
- the context factory to decorate- 返回:
- an updated supplier that will set the
MockServletContext
-