Change beans.xml filename in Spring MVC

Spring Framework logo

If you start using Spring MVC to develop Web Applications and you declare the DispatcherServlet in web.xml, it’s a little bit annoying to rename the Spring beans file to xxxx-servlet.xml, for example, if you declare DispatcherServlet like this:

Your beans.xml file has to be renamed to springservlet-servlet.xml to let DispatcherServlet find the configuration file. But, we can change this behavior by specifying to DispatcherServlet the name of our Spring Beans file in the next way:

Continue reading