spring-framework / org.springframework.context.support / GenericXmlApplicationContext

GenericXmlApplicationContext

open class GenericXmlApplicationContext : GenericApplicationContext

Convenient application context with built-in XML support. This is a flexible alternative to ClassPathXmlApplicationContext and FileSystemXmlApplicationContext, to be configured via setters, with an eventual #refresh() call activating the context.

In case of multiple configuration files, bean definitions in later files will override those defined in earlier files. This can be leveraged to intentionally override certain bean definitions via an extra configuration file appended to the list.

Author
Juergen Hoeller

Author
Chris Beams

Since
3.0

See Also
#loadXmlBeanDefinitionReaderorg.springframework.context.annotation.AnnotationConfigApplicationContext

Constructors

<init>

GenericXmlApplicationContext()

Create a new GenericXmlApplicationContext that needs to be loaded and then manually refreshed.

GenericXmlApplicationContext(vararg resources: Resource)

Create a new GenericXmlApplicationContext, loading bean definitions from the given resources and automatically refreshing the context.

GenericXmlApplicationContext(vararg resourceLocations: String)
GenericXmlApplicationContext(relativeClass: Class<*>, vararg resourceNames: String)

Create a new GenericXmlApplicationContext, loading bean definitions from the given resource locations and automatically refreshing the context.

Functions

getReader

fun getReader(): XmlBeanDefinitionReader

Exposes the underlying XmlBeanDefinitionReader for additional configuration facilities and loadBeanDefinition variations.

load

open fun load(vararg resources: Resource): Unit
open fun load(vararg resourceLocations: String): Unit
open fun load(relativeClass: Class<*>, vararg resourceNames: String): Unit

Load bean definitions from the given XML resources.

setEnvironment

open fun setEnvironment(environment: ConfigurableEnvironment): Unit

Delegates the given environment to underlying XmlBeanDefinitionReader. Should be called before any call to #load.

setValidating

open fun setValidating(validating: Boolean): Unit

Set whether to use XML validation. Default is true.