我们知道spring在web.xml中可以有三种方式来配置其xml路径:
org.springframework.web.servlet.DispatcherServlet
org.springframework.web.context.ContextLoaderListener
org.springframework.web.context.ContextLoaderServlet
当使用第一种方式配置时,spring载入的WebApplicationContext是隶属于本Servlet的(所以spring可以配置多个分别拥有各自环境的DispatcherServlet),因此其他servlet无法获取到该Context。
而其他两种方式加载的context则是全局的。