What type of information should be present in the dispatcher-servlet.xml and applicationContext.xml?
Asked
Active
Viewed 151 times
0
-
possible duplicate of [Spring + Web MVC: dispatcher-servlet.xml vs. applicationContext.xml (plus shared security)](http://stackoverflow.com/questions/16458754/spring-web-mvc-dispatcher-servlet-xml-vs-applicationcontext-xml-plus-shared) – Pradeep Kr Kaushal Jan 31 '14 at 07:10
-
Possible duplicate of http://stackoverflow.com/questions/16458754/spring-web-mvc-dispatcher-servlet-xml-vs-applicationcontext-xml-plus-shared – Pradeep Kr Kaushal Jan 31 '14 at 07:10
1 Answers
3
The applicationContext.xml
is loaded by the ContextLoadeListener
and should contain your shared/global beans. Things like the datasource, jms connecetionfactories, services, repositories etc.
Your dispatcher-servlet.xml
is loaded by the DispatcherServlet
and should contain only web related things like controllers, viewresolvers, exceptionhandlers etc.
This is a general rule of thumb of course.

M. Deinum
- 115,695
- 22
- 220
- 224