在第一次运行SpringMVC项目时报了这样一个错误
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/springmvc-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/springmvc-servlet.xml]
没有找到springmvc的配置文件,最后检查才发现在web.xml中没有绑定springmvc的配置文件,在servlet标签中加入代码
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc.xml</param-value>
</init-param>
成功解决问题