您的位置:首页 > 移动开发

Could not open ServletContext resource [/WEB-INF/applicationContext.xml]解决方法

2018-04-03 17:10 726 查看
启动Spring的时候报出了这个错误 就是applicationContext.xml这个文件没有找到解决方法配置<context-paramter>参数<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>其次,配置一个监听器,监听器里面还要配置这个路径<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:applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Spring的官方文档里面有这样一句话:
如果不特意指定参数名为contextConfigLoction的<context-parameter>元素,那么spring的ContextLoderListener监听器就会在/WEB-INF/下去寻找并加载该目录下的名为applicationContext.xml这个文件
再次启动,没有问题了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐