xxx-servlet.xml vs applicationContext.xml
Spring lets you define multiple contexts in a parent-child hierarchy.
The applicationContext.xml defines the beans for the "root webapp context", i.e. the context associated with the webapp.
The spring-servlet.xml (or whatever else you call it) defines the beans for one servlet's app context. There can be many of these in a webapp, one per Spring servlet (e.g. spring1-servlet.xml for servlet spring1, spring2-servlet.xml for servlet spring2).
Beans in spring-servlet.xml can reference beans in applicationContext.xml, but not vice versa.
All Spring MVC controllers must go in the spring-servlet.xml context.
In most simple cases, the applicationContext.xml context is unnecessary. It is generally used to contain beans that are shared between all servlets in a webapp. If you only have one servlet, then there's not really much point, unless you have a specific use for it.
意思是 在spring mvc中 一个servlet 会对应一个webapplicationContext(ps:也就是 有可能 多个 spring容器)。 而配置applicationContext.xml 只会有一个spring 容器(ps:2中容器是父子容器 是共享的。子容器能访问富容器内容)。 当配置了多个servlet后 就会有多个spring容器 这时候如果在springmvc中配置datasoure 之类的 全局共享的bean 就不合适。。于是 需要 将这种全局共享的 定义到 applicationContext.xml 。
这时候会引发一个问题 父子容器导致 事务失败。如连接:http://blog.csdn.net/liujan511536/article/details/48002885
but 大部分情况我觉得一个servlet足矣