Could not open ServletContext resource [/WEB-INF/applicationContext.xml]解决方法
在整合spring,springMVC,hibernate的时候,因为从webinf的文件夹下移除了springMVC的配置文件到src下,所以,idea从默认的位置找不到配置文件,需要在web.xml指定地址。
原来的是:
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.form</url-pattern>
</servlet-mapping>
加入地址:注意文件名<param-name>contextConfigLocation</param-name>,这里写错的,也加载不到
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:mvc_config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.form</url-pattern>
</servlet-mapping>