Spring lets define multiple contexts in a parent-child hierarchy.
The applicationcontext.xml defines the beans for the "root webapp context" and i.e. the context associated with the WebApp.
The spring-servlet.xml (or whatever else call it) defines the beans for one servlet's app context. There can many of these in a webapp, one per Spring servlet (e.g. Spring1-servlet.xml for servlet spring1, Spring2-serv Let.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 more simple cases, the applicationcontext.xml context is unnecessary. It's generally used to contain beans, that's shared between all servlets in a webapp. If you are only having one servlet, then there's not really much point, unless has a specific use for it.
This means that in spring MVC a servlet will correspond to a webapplicationcontext (PS: That is, it is possible to have multiple spring containers). The configuration applicationcontext.xml will only have a spring container (the container in Ps:2 is a parent-child container that is shared. Sub-containers can access rich container content). When multiple servlets are configured, there will be more than one spring container at this time if a globally shared bean such as Datasoure is configured in SPRINGMVC is not appropriate. The definition of this global share needs to be applicationcontext.xml.
This can cause a problem when the parent-child container causes the transaction to fail. such as connection: http://blog.csdn.net/liujan511536/article/details/48002885
But in most cases, I think a servlet is enough.
Xxx-servlet.xml vs Applicationcontext.xml