In my application I have placed the ApplicationContext xml
file in src and the project is working fine.
Can we place the ApplicationContext.xml
in
There are couple of ways you can do this:
In Spring MVC, You mention dispatcher-servlet
in web.xml
as follows
mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1
Now this by default will look for a file named mvc-dispatcher-servlet.xml
. That is, the servlet name appended by -servlet.xml. And it will look for this file in class path.
Alternatively which fits your case, if you already have xml file and don't want to rename it, add the following entry in web.xml in addition to the servlet entry above.
contextConfigLocation /WEB-INF/conf/ApplicationContext.xml
Here you can choose any location inside WEB-INF. Put the properties file in classes folder so that it could be found in classpath. Since you are using Eclipse embedded Tomcat, put the following as your bean configuration for property placeholder.