WebApplicationContextRunner

An ApplicationContext runner for a Servlet based ConfigurableWebApplicationContext.

See AbstractApplicationContextRunner for details.

Author

Andy Wilkinson

Stephane Nicoll

Phillip Webb

Since

2.0.0

Constructors

Link copied to clipboard
constructor()
Create a new WebApplicationContextRunner instance using an AnnotationConfigServletWebApplicationContext with a MockServletContext as the underlying source.
constructor(contextFactory: Supplier<ConfigurableWebApplicationContext>)
Create a new WebApplicationContextRunner instance using the specified contextFactory as the underlying source.

Functions

Link copied to clipboard
open fun prepare(consumer: ContextConsumer<in A>): SELF
Prepare a new ApplicationContext based on the current state of this loader.
Link copied to clipboard
open fun run(consumer: ContextConsumer<in A>): SELF
Create and refresh a new ApplicationContext based on the current state of this loader.
Link copied to clipboard
open fun with(customizer: (SELF) -> SELF): SELF
Apply customization to this runner.
Link copied to clipboard
open fun withAllowBeanDefinitionOverriding(allowBeanDefinitionOverriding: Boolean): SELF
Specify if bean definition overriding, by registering a definition with the same name as an existing definition, should be allowed.
Link copied to clipboard
open fun withAllowCircularReferences(allowCircularReferences: Boolean): SELF
Specify if circular references between beans should be allowed.
Link copied to clipboard
open fun <T> withBean(type: Class<T>, constructorArgs: Array<Any>): SELF
open fun <T> withBean(type: Class<T>, supplier: Supplier<T>, customizers: Array<BeanDefinitionCustomizer>): SELF
open fun <T> withBean(name: String, type: Class<T>, constructorArgs: Array<Any>): SELF
open fun <T> withBean(name: String, type: Class<T>, supplier: Supplier<T>, customizers: Array<BeanDefinitionCustomizer>): SELF
Register the specified user bean with the ApplicationContext.
Link copied to clipboard
open fun withClassLoader(classLoader: ClassLoader): SELF
Customize the ClassLoader that the ApplicationContext should use for resource loading and bean class loading.
Link copied to clipboard
open fun withConfiguration(configurations: Configurations): SELF
Register the specified configuration classes with the ApplicationContext.
Link copied to clipboard
open fun withInitializer(initializer: ApplicationContextInitializer<in C>): SELF
Add an ApplicationContextInitializer to be called when the context is created.
Link copied to clipboard
open fun withMockServletContext(contextFactory: Supplier<ConfigurableWebApplicationContext>): Supplier<ConfigurableWebApplicationContext>
Decorate the specified contextFactory to set a MockServletContext on each newly created WebApplicationContext.
Link copied to clipboard
open fun withParent(parent: ApplicationContext): SELF
Configure the parent of the ApplicationContext.
Link copied to clipboard
open fun withPropertyValues(pairs: Array<String>): SELF
Add the specified Environment property pairs.
Link copied to clipboard
Add the specified System property pairs.
Link copied to clipboard
open fun withUserConfiguration(configurationClasses: Array<Class<out Any>>): SELF
Register the specified user configuration classes with the ApplicationContext.