org.springframework.web.context.support
Class XmlWebApplicationContext
org.springframework.context.support.AbstractApplicationContext
|
+--org.springframework.context.support.AbstractXmlApplicationContext
|
+--org.springframework.ui.context.support.AbstractXmlUiApplicationContext
|
+--org.springframework.web.context.support.XmlWebApplicationContext
- public class XmlWebApplicationContext
- extends AbstractXmlUiApplicationContext
- implements ConfigurableWebApplicationContext
WebApplicationContext implementation that takes configuration from an XML document.
By default, the configuration will be taken from "/WEB-INF/applicationContext.xml"
for the root context, and "/WEB-INF/test-servlet.xml" for a context with the namespace
"test-servlet" (like for a DispatcherServlet instance with the web.xml servlet-name "test").
These config location defaults can be overridden via setConfigLocations, respectively
via the "contextConfigLocation" parameters of ContextLoader and FrameworkServlet.
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.
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 AbstractApplicationContext.
- Author:
- Rod Johnson, Juergen Hoeller
- See Also: setNamespace(java.lang.String), setConfigLocations(java.lang.String[]), org.springframework.web.context.ContextLoader.initWebApplicationContext(ServletContext), org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(), org.springframework.context.support.AbstractApplicationContext.getResource(java.lang.String)
Methods inherited from class org.springframework.context.support.AbstractApplicationContext |
close, containsBean, containsBeanDefinition, getAliases, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeansOfType, getDisplayName, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResource, getStartupDate, isSingleton, publishEvent, setParent |
DEFAULT_CONFIG_LOCATION
public final static String DEFAULT_CONFIG_LOCATION
- Default config location for the root context
DEFAULT_CONFIG_LOCATION_PREFIX
public final static String DEFAULT_CONFIG_LOCATION_PREFIX
- Default prefix for building a config location for a namespace
DEFAULT_CONFIG_LOCATION_SUFFIX
public final static String DEFAULT_CONFIG_LOCATION_SUFFIX
- Default suffix for building a config location for a namespace
getServletContext
public ServletContext getServletContext()
refresh
public void refresh()
throws org.springframework.beans.BeansException
setConfigLocations
public void setConfigLocations(String[] configLocations)
setNamespace
public void setNamespace(String namespace)
setServletContext
public void setServletContext(ServletContext servletContext)
toString
public String toString()
- Return diagnostic information.
to Class java.lang.String- Default config location for the root context
to Class java.lang.String
- Default prefix for building a config location for a namespace
to Class java.lang.String
- Default suffix for building a config location for a namespace
to Class java.lang.String
- Namespace of this context, or null if root
to Class java.lang.String
- Paths to XML configuration files