Caused by: java.io.FileNotFoundException: class path resource [../../resources/config/spring.xml] cannot be opened because it does not exist
在尝试使用Spring的Test的时候遇到了这个错误
原来的代码:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"../../../resources/config/spring.xml"})
public class TestFund { @Autowired
private FundService fundService; @Test
public void testFundSelectAll() {
//System.out.println("所有基金: " + fundService.selectAll());
System.out.println(fundService);
}
}
原因分析:
修改spring的配置文件spring.xml的位置
解决方法:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:config/spring.xml")
public class TestFund { @Autowired
private FundService fundService; @Test
public void testFundSelectAll() {
//System.out.println("所有基金: " + fundService.selectAll());
System.out.println(fundService);
}
}
问题解决!
Caused by: java.io.FileNotFoundException: class path resource [../../resources/config/spring.xml] cannot be opened because it does not exist的更多相关文章
- 解决CXF的java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-soap.xml] cannot be opened because it does not exist
以下是错误信息 九月 25, 2017 8:22:04 下午 org.springframework.web.context.support.XmlWebApplicationContext prep ...
- java.io.FileNotFoundException: class path resource [META-INF/xfire/services.xml] cannot be opened because it does not exist
解决办法: maven创建项目时: META-INF目录下面新建一个xfire文件夹,把services.xml文件放到这个文件夹里,再将整个META-INF拷贝到WEB-INF中 clean一下工程 ...
- cxf(3.1.1) 异常Caused by: java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-soap.xml]
Caused by: java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-soap.xml] ...
- Caused by: java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be ope
1.错误描述 java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.tes ...
- Caused by: java.io.FileNotFoundException: class path resource [spring/springmvc.xml] cannot be opene
Caused by: java.io.FileNotFoundException: class path resource [spring/springmvc. ...
- Caused by: java.io.FileNotFoundException: class path resource
异常: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.c ...
- Caused by: java.io.FileNotFoundException: class path resource [com/cxy/springboot/mapping/] cannot be resolved to URL because it does not exist
java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.conte ...
- spring junit class path resource [ /com/config/spring-core.xml] cannot be opened because it does not exist
正确写法应该如下: @RunWith(SpringJUnit4ClassRunner.class) //@ContextConfiguration(locations="classpath: ...
- 启动tomcat报错Caused by: java.io.FileNotFoundException: class path resource [io/renren/controller/NodeDataController] cannot be opened because it does not exist
?? 清理项目,再重启服务就好了.........
随机推荐
- Java集合--Map
Map接口(双例集合): Map提供了映射关系,存放的元素是以key-value键值对存放的.可以根据key快速的查询value.key不可以重复,value可以重复. 常用实现类:HashMap,H ...
- offsetof宏与container_of宏
offsetof宏与container_of宏1.由结构体指针进而访问各元素的原理(1)通过结构体整体变量来访问其中各个元素,本质上是通过指针方式来访问的,形式上是通过.的方式来访问的(这个时候其实是 ...
- C#调用C++系列一:简单传值
因为去实习的时候有一个小任务是C#想调用C++ opencv实现的一些处理,那我主要的想法就是将C++实现的OpenCV处理封装成dll库供C#调用,这里面还会涉及到一些托管和非托管的概念,我暂时的做 ...
- LeetCode随想------Single Number-----关于异或的性质
异或满足交换律,结合律 任何数X^X=0,X^0=X 自反性 A XOR B XOR B = A xor 0 = A 设有A,B两个变量,存储的值分别为a,b,则以下三行表达式将互换他们的值 表达 ...
- SPOJ 247 chocolate (CHOCLO)
题目http://www.spoj.com/problems/CHOCOLA/ 把一整块巧克力分成一个一个单元,掰断每一横行有个代价值,掰断每个纵行也有个代价值,要你求最后的总代价值最小 这个题目放在 ...
- Thread--使用condition实现顺序执行
package condition; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Re ...
- 108.生成和下载csv文件
生成CSV文件 有时候我们做的网站,需要将一些数据,生成一个csv文件返回浏览器,并且是作为附件的形式下载下来. 生成小的csv文件: 生成一个小的csv文件,我们用Python内置的csv模块来处理 ...
- Python笔记_第四篇_高阶编程_高阶函数_2.filter
1. filter函数: 原型:filter(fn,lsd) 参数1为函数 参数2为序列 功能:用于过滤序列,把传入的函数一次作用域序列每个元素,根据返回的是True还是False决定是否保留该元素. ...
- Ubuntu---不能打开 exfat 文件系统格式的 U盘解决方法
出现问题:今天把 U 盘插入 Ubuntu 系统的电脑中,打开 U 盘发现弹出 系统格式不支持 的提醒,无法进入 U 盘进行操作. 环境: Ubuntu18.04 TSL; 格式化为 exfat 文件 ...
- Android Studio 停靠模式(Docked Mode)
如果之前选了任务一种模式,先全都取消了 然后点击Window -->Active Tool Window-->这个时候就可以选择Docked Mode了