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

FileSystemXmlApplicationContext

open class FileSystemXmlApplicationContext : AbstractXmlApplicationContext

Standalone XML application context, taking the context definition files from the file system or from URLs, interpreting plain paths as relative file system locations (e.g. "mydir/myfile.txt"). Useful for test harnesses as well as for standalone environments.

NOTE: Plain paths will always be interpreted as relative to the current VM working directory, even if they start with a slash. (This is consistent with the semantics in a Servlet container.) Use an explicit "file:" prefix to enforce an absolute file path.

The config location defaults can be overridden via #getConfigLocations, Config locations can either denote concrete files like "/myfiles/context.xml" or Ant-style patterns like "/myfiles/*-context.xml" (see the org.springframework.util.AntPathMatcher javadoc for pattern details).

Note: In case of multiple config locations, later bean definitions will override ones defined in earlier loaded files. This can be leveraged to deliberately override certain bean definitions via an extra XML file.

This is a simple, one-stop shop convenience ApplicationContext. Consider using the GenericApplicationContext class in combination with an org.springframework.beans.factory.xml.XmlBeanDefinitionReader for more flexible context setup.

Author
Rod Johnson

Author
Juergen Hoeller

See Also
#getResource#getResourceByPathGenericApplicationContext

Constructors

<init>

FileSystemXmlApplicationContext()
FileSystemXmlApplicationContext(parent: ApplicationContext)

Create a new FileSystemXmlApplicationContext for bean-style configuration.

FileSystemXmlApplicationContext(configLocation: String)

Create a new FileSystemXmlApplicationContext, loading the definitions from the given XML file and automatically refreshing the context.

FileSystemXmlApplicationContext(vararg configLocations: String)

Create a new FileSystemXmlApplicationContext, loading the definitions from the given XML files and automatically refreshing the context.

FileSystemXmlApplicationContext(configLocations: Array<String>, parent: ApplicationContext)

Create a new FileSystemXmlApplicationContext with the given parent, loading the definitions from the given XML files and automatically refreshing the context.

FileSystemXmlApplicationContext(configLocations: Array<String>, refresh: Boolean)

Create a new FileSystemXmlApplicationContext, loading the definitions from the given XML files.

FileSystemXmlApplicationContext(configLocations: Array<String>, refresh: Boolean, parent: ApplicationContext)

Create a new FileSystemXmlApplicationContext with the given parent, loading the definitions from the given XML files.

Inherited Functions

setValidating

open fun setValidating(validating: Boolean): Unit

Set whether to use XML validation. Default is true.