Reference:
http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-servlet
I was going through Spring's official documentation on ApplicationContext and WebApplication Context. However I am getting confused with the use of similar terminologies. e.g. In the diagram - "Context hierarchy in Spring Web MVC" from the official documentation link above it is mentioned that
ApplicationContext instances in Spring can be scoped. In the Web MVC framework, each DispatcherServlet has its own WebApplicationContext, which inherits all the beans already defined in the root WebApplicationContext. These inherited beans can be overridden in the servlet-specific scope, and you can define new scope-specific beans local to a given servlet instance.
My understanding is that both ApplicationContext and WebApplication context are the spring containers where WebApplicationContext is child of the ApplicationContext interface.
Question 1 So in the diagram "Context hierarchy in Spring Web MVC" what is the use of root WebApplicationContext? Is this same as ApplicationContext which is defined from applicationContext.xml file?
Question 2 Why can there be multiple WebApplicationContext (s) e.g. services, datasources etc.if ApplicationContext is considered to be the root context for every web application.