public final class ReactiveWebApplicationContextRunner extends Object
ApplicationContext runner
for a
ConfigurableReactiveWebApplicationContext
.
See AbstractApplicationContextRunner
for details.
Constructor and Description |
---|
ReactiveWebApplicationContextRunner()
Create a new
ReactiveWebApplicationContextRunner instance using a
AnnotationConfigReactiveWebApplicationContext as the underlying source. |
ReactiveWebApplicationContextRunner(Supplier<ConfigurableReactiveWebApplicationContext> contextFactory)
Create a new
ApplicationContextRunner instance using the specified
contextFactory as the underlying source. |
Modifier and Type | Method and Description |
---|---|
protected ReactiveWebApplicationContextRunner |
newInstance(Supplier<ConfigurableReactiveWebApplicationContext> contextFactory,
TestPropertyValues environmentProperties,
TestPropertyValues systemProperties,
ClassLoader classLoader,
org.springframework.context.ApplicationContext parent,
List<Configurations> configurations) |
SELF |
run(ContextConsumer<? super A> consumer)
Create and refresh a new
ApplicationContext based on the current state of
this loader. |
SELF |
withClassLoader(ClassLoader classLoader)
Customize the
ClassLoader that the ApplicationContext should use. |
SELF |
withConfiguration(Configurations configurations)
Register the specified configuration classes with the
ApplicationContext . |
SELF |
withParent(org.springframework.context.ApplicationContext parent)
Configure the
parent of the ApplicationContext . |
SELF |
withPropertyValues(String... pairs)
Add the specified
Environment property pairs. |
SELF |
withSystemProperties(String... pairs)
Add the specified
System property pairs. |
SELF |
withUserConfiguration(Class<?>... configurationClasses)
Register the specified user configuration classes with the
ApplicationContext . |
public ReactiveWebApplicationContextRunner()
ReactiveWebApplicationContextRunner
instance using a
AnnotationConfigReactiveWebApplicationContext
as the underlying source.public ReactiveWebApplicationContextRunner(Supplier<ConfigurableReactiveWebApplicationContext> contextFactory)
ApplicationContextRunner
instance using the specified
contextFactory
as the underlying source.contextFactory
- a supplier that returns a new instance on each callprotected ReactiveWebApplicationContextRunner newInstance(Supplier<ConfigurableReactiveWebApplicationContext> contextFactory, TestPropertyValues environmentProperties, TestPropertyValues systemProperties, ClassLoader classLoader, org.springframework.context.ApplicationContext parent, List<Configurations> configurations)
public SELF withPropertyValues(String... pairs)
Environment
property pairs. Key-value pairs can be
specified with colon (":") or equals ("=") separators. Override matching keys that
might have been specified previously.pairs
- the key-value pairs for properties that need to be added to the
environmentTestPropertyValues
,
withSystemProperties(String...)
public SELF withSystemProperties(String... pairs)
System
property pairs. Key-value pairs can be specified
with colon (":") or equals ("=") separators. System properties are added before the
context is run
and restored when the context is
closed.pairs
- the key-value pairs for properties that need to be added to the systemTestPropertyValues
,
withSystemProperties(String...)
public SELF withClassLoader(ClassLoader classLoader)
ClassLoader
that the ApplicationContext
should use.
Customizing the ClassLoader
is an effective manner to hide resources from
the classpath.classLoader
- the classloader to use (can be null to use the default)HidePackagesClassLoader
public SELF withParent(org.springframework.context.ApplicationContext parent)
parent
of the ApplicationContext
.parent
- the parentpublic SELF withUserConfiguration(Class<?>... configurationClasses)
ApplicationContext
.configurationClasses
- the user configuration classes to addpublic SELF withConfiguration(Configurations configurations)
ApplicationContext
.configurations
- the configurations to addpublic SELF run(ContextConsumer<? super A> consumer)
ApplicationContext
based on the current state of
this loader. The context is consumed by the specified consumer
and closed
upon completion.consumer
- the consumer of the created ApplicationContext
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.