项目重构过程中容易出现配置文件applicationContext.xml找不到的情况,解决方案:
首先
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath:applicationContext.xml</param-value>
- </context-param>
然后
- <servlet>
- <servlet-name>springMvc</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath:applicationContext.xml</param-value>
- </init-param>
- <load-on-startup>2</load-on-startup>
- </servlet>