Caused by: java.io.FileNotFoundException: class path resource [../../resources/config/spring.xml] cannot be opened because it does not exist
2024-08-30 07:13:54
在尝试使用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);
}
}
问题解决!
最新文章
- android 控件在不同状态下的内容样式与背景样式
- 使用JFinal的第一个项目出现的问题(The return type is incompatible with JspSourceDependent.getDependants())
- 【BZOJ-1858】序列操作 线段树
- 初始Jquery--以及工厂函数
- Java 第五天 Spring IOC 配置文件
- 让UITableViewCell的分隔线宽度等于屏幕的宽度
- jQuery中的supersized的插件的功能描述
- java--socket实现一个client像还有一个client发送信息
- 矩阵类c++实现
- centos 把网卡名称修改为 eth0
- ASP.NET Core 依赖注入
- c/c++ 基本线程管理 join detach
- [STM32F103]外部中断
- 从MongoDB里面取得json格式的数据,然后存为本地的json文件,然后再从json读取变为dict
- MANIPULATION
- jsp页面跳转页面的几中方式(同步更新)
- 程序员面试50题—sizeof的用法(6)
- 【暴力Treap 或 离线归并】子串计数(genies)
- ecshop安装
- 4-14-17 JavaScript知识点总结(包括JOSN, ajax等,来源w3c)