ApplicationContext
实现类,派生于 {@link org.springframework.web.context.support.XmlWebApplicationContext},增加了如下特性: ConfigurationPoint
机制。ResourceLoadingExtender
被设置,则使用它来装载资源,否则使用默认的装载器。<context:annotation-config/>
。 parentResolvableDependenciesAccessible==true
,则支持从parent context中取得预先置入resolvableDependencies
中的对象。默认为true
。建议所有非WEB应用的application context从 {@link AbstractXmlApplicationContext}派生;对于简单的情形,如单元测试,直接从子类 {@link XmlApplicationContext}中创建实例。
@author Michael Zhou @see AbstractXmlApplicationContext @see XmlApplicationContextBy 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 servlet-name "test").
The config location defaults can be overridden via the "contextConfigLocation" context-param of {@link org.springframework.web.context.ContextLoader} and servletinit-param of {@link org.springframework.web.servlet.FrameworkServlet}. Config locations can either denote concrete files like "/WEB-INF/context.xml" or Ant-style patterns like "/WEB-INF/*-context.xml" (see {@link org.springframework.util.PathMatcher}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.
For a WebApplicationContext that reads in a different bean definition format, create an analogous subclass of {@link AbstractRefreshableWebApplicationContext}. Such a context implementation can be specified as "contextClass" context-param for ContextLoader or "contextClass" init-param for FrameworkServlet. @author Rod Johnson @author Juergen Hoeller @see #setNamespace @see #setConfigLocations @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader @see org.springframework.web.context.ContextLoader#initWebApplicationContext @see org.springframework.web.servlet.FrameworkServlet#initWebApplicationContext
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|