spring-framework / org.springframework.web.context.support / StaticWebApplicationContext

StaticWebApplicationContext

open class StaticWebApplicationContext : StaticApplicationContext, ConfigurableWebApplicationContext, ThemeSource

Static org.springframework.web.context.WebApplicationContext implementation for testing. Not intended for use in production applications.

Implements the org.springframework.web.context.ConfigurableWebApplicationContext interface to allow for direct replacement of an XmlWebApplicationContext, despite not actually supporting external configuration files.

Interprets resource paths as servlet context resources, i.e. as paths beneath the web application root. Absolute paths, e.g. for files outside the web app root, can be accessed via "file:" URLs, as implemented by org.springframework.core.io.DefaultResourceLoader.

In addition to the special beans detected by org.springframework.context.support.AbstractApplicationContext, this class detects a bean of type org.springframework.ui.context.ThemeSource in the context, under the special bean name "themeSource".

Author
Rod Johnson

Author
Juergen Hoeller

See Also
org.springframework.ui.context.ThemeSource

Constructors

<init>

StaticWebApplicationContext()

Functions

getConfigLocations

open fun getConfigLocations(): Array<String>

getNamespace

open fun getNamespace(): String

getServletConfig

open fun getServletConfig(): ServletConfig

getServletContext

open fun getServletContext(): ServletContext

getTheme

open fun getTheme(themeName: String): Theme

setConfigLocation

open fun setConfigLocation(configLocation: String): Unit

The StaticWebApplicationContext class does not support this method.

setConfigLocations

open fun setConfigLocations(vararg configLocations: String): Unit

The StaticWebApplicationContext class does not support this method.

setNamespace

open fun setNamespace(namespace: String): Unit

setServletConfig

open fun setServletConfig(servletConfig: ServletConfig): Unit

setServletContext

open fun setServletContext(servletContext: ServletContext): Unit

Set the ServletContext that this WebApplicationContext runs in.

Inherited Functions

addMessage

open fun addMessage(code: String, locale: Locale, defaultMessage: String): Unit

Associate the given message with the given code.

getStaticMessageSource

fun getStaticMessageSource(): StaticMessageSource

Return the internal StaticMessageSource used by this context. Can be used to register messages on it.

registerPrototype

open fun registerPrototype(name: String, clazz: Class<*>): Unit
open fun registerPrototype(name: String, clazz: Class<*>, pvs: MutablePropertyValues): Unit

Register a prototype bean with the underlying bean factory.

For more advanced needs, register with the underlying BeanFactory directly.

registerSingleton

open fun registerSingleton(name: String, clazz: Class<*>): Unit
open fun registerSingleton(name: String, clazz: Class<*>, pvs: MutablePropertyValues): Unit

Register a singleton bean with the underlying bean factory.

For more advanced needs, register with the underlying BeanFactory directly.