ApplicationContext:
Provides a central interface to the configuration for the application. This is read-only while the application is running, but is reloaded if the implementation supports it. ApplicationContext provides: Bean factory methods for accessing application components.
Inherited from {@ linkorg springframework. Beans. Factory. ListableBeanFactory} ability to load the file resources in general way.
Inherited from {@ link org. Springframework. Core. IO. ResourceLoader} interface, can release the incident to the registered listener. Inherited from {@ link ApplicationEventPublisher} interface, the ability to parse the message of support for internationalization.
Inheriting from the {@Link MessageSource} interface, inheriting from the parent context. Definitions in descendant contexts will always take precedence. This means, for example, that a single parent context can be used by the entire Web application, and that each servlet has its own subcontext independent of any other servlet’s subcontext.
In addition to standard {@ link org. Springframework. Beans. Factory. The BeanFactory} function of life cycle, ApplicationContext implements the detection and invocation of {@Link ApplicationContextAware} beans and {@Link ResourceLoaderAware}, {@ link ApplicationEventPublisherAware} and {@ link MessageSourceAware} bean.
WenApplicationContext:
Provides a configured interface to the Web application, which is read-only while the application is running, but may be reloaded if the implementation supports it.
This interface adds a {@code getServletContext()} method, the ApplicationContext interface, and defines a well-known application property name that must be bound to the root context during boot.
Like the generic application context, the Web application context is hierarchical. Each application has a root context, and each servlet in the application (including dispatcher servlets in the MVC framework) has its own subcontext. In addition to the standard application context lifecycle capabilities, the WebApplicationContext implementation also needs to detect the {@Link ServletContextAware} bean and call the {@code setServletContext} method accordingly.
The XmlWebApplicationContext:
{@ link org. Springframework. Web. Context. WebApplicationContext} implementation class it made its configuration from the XML document, By {@ link org. Springframework. Beans. Factory. XML. XmlBeanDefinitionReader}.
Essentially equivalent to {@ link org. Springframework. Context. Support. GenericXmlApplicationContext} is used in the web environment.
By default, the configuration will be from the “XML/WEB – INF/applicationContext.” get to the root context, “/ WEB – INF/test – servlet. XML” used in a namespace context
“Test-servlet” (similar to a DispatcherServlet instance with servlet name “test”).
Can pass the contextConfigLocation cover configuration location default value {@ link org. Springframework. Web. Context. ContextLoader} and servlet context parameter {@ the link Org. Springframework. Web. Servlet. FrameworkServlet} initialization parameter.
Configuration locations can represent specific files, such as “/WEB-INF/context.xml” or Ant style schemas, Like “/ WEB – INF / * – context. XML” (see {@ link org. Springframework. Util. PathMatcher} mode javadoc for more information.
Note: In the case of multiple configuration locations, the beans defined after will override those defined in the previously loaded file. This can be used to deliberately overwrite some bean definitions with additional XML files. For WebApplicationContext to read different bean definition format, create a similar {@ link AbstractRefreshableWebApplicationContext} subclasses. Such a context implementation can be specified as “contextClass” context parameter for ContextLoader or “contextClass” init-param for FrameworkServlet.