Spring配置文件applicationContext.xml 找不到的问题
2016-11-28 09:30
861 查看
使用maven创建web工程,将Spring配置文件applicationContext.xml放在src/resource下,用eclipse编译时提示class path resource [applicationContext.xml] cannot be opened because it does not exist错误。
web.xml配置的如下
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
用google搜索一下 发现是由于classpath不是指向resource路径,导致一直找不到文件。需要在classpath后面加个*,这样就解决问题了。
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext.xml</param-value>
</context-param>
感谢mr_pang 的帮助!
web.xml配置的如下
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
用google搜索一下 发现是由于classpath不是指向resource路径,导致一直找不到文件。需要在classpath后面加个*,这样就解决问题了。
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext.xml</param-value>
</context-param>
感谢mr_pang 的帮助!
相关文章推荐
- spring 配置文件无法加载,junit找不到xml配置文件java.lang.IllegalStateException: Failed to load ApplicationContext
- Spring的applicationContext.xml配置文件的一些问题
- Spring的applicationContext.xml配置文件的一些问题
- spring、hibernate整合核心配置文件applicationContext.xml
- Hibernate SQL方言 (hibernate.dialect) Spring配置文件applicationContext.xml
- 【SpringMVC之配置文件(一)】spring 里面的ApplicationContext.xml 和 xxx-servlet.xml分别的作用是什么?
- spring配置文件ApplicationContext.xml里面class等没有提示功能
- 记录一次mac+idea+springmvc开发的applicationContext.xml读取文件找不到异常处理
- 浅谈配置文件:spring-servlet.xml(spring-mvc.xml) 与 applicationContext.xml
- spring、mybatis整合核心配置文件applicationContext.xml
- spring配置文件ApplicationContext.xml文件里面代码没有提示功能
- spring applicationContext.xml 配置文件详解
- Spring applicationContext.xml 文件 路径配置 (2)
- Spring基础学习教程(applicationContext.xml 配置文件 详解)-07
- 使用Spring中的ClassPathXmlApplicationContext加载配置文件
- 【SpringMVC之配置文件(一)】spring 里面的ApplicationContext.xml 和 xxx-servlet.xml分别的作用是什么?
- Spring源码学习--Spring配置解析文件ApplicationContext.xml(一)
- applicationContext.xml文件中怎么配置struts2和spring配置文件的加载路径
- Spring中,applicationContext.xml 配置文件在web.xml中的配置详解
- Spring中,applicationContext.xml 配置文件在web.xml中的配置详解