Neither GenericXmlContextLoader nor AnnotationConfigContextLoader was able to detect defaults
来源:互联网 发布:淘宝 购物 编辑:程序博客网 时间:2024/06/05 13:24
今天使用spring TestContext测试spring应用程序时,发现上述错误,经过多次检查,发现UserManagerImplTest-context.xml的位置不对,必须将该文件放置在测试文件同一个包中,而且名字必须是 ” 测试类名-context.xml".且文件内容指定为
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<import resource="classpath:beans.xml"/>
</beans>
其中classpath:表示指定spring的配置文件在classpath的位置。
除此之外,该测试类上必须指明@ContextConfiguration,属性注入时在属性上指明@resource或者@Autowired,测试方法指明@test
0 0
- Neither GenericXmlContextLoader nor AnnotationConfigContextLoader was able to detect defaults
- centos7 configure: error: Neither flex nor lex was found.
- configure: error: Neither flex nor lex was found.
- WindowBuilder was not able to show the GUI
- CocoaPods was not able to update the `master` repo....
- 解决 CocoaPods was not able to update the `master` repo
- 为什么会出现警告:Data binding will not be able to detect assignments to “**”
- <restriction> element was found that has neither a base [attribute] nor a <simpleType> element among
- It's likely that neither a Result Type nor a Result Map was specified
- QGtkStyle was unable to detect the current GTK+ theme接
- QGtkStyle was unable to detect the current GTK+ theme
- No permission to write APN settings: Neither user 10047 nor current process has android.permission.W
- Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.
- [工作点滴]It's likely that neither a Result Type nor a Result Map was specified
- 解决 anyconnect was net able to establish a connection to the specified secure gateway
- Problem with AnyConnect was not able to establish connection to the specified secure gateway." Cis
- AnyConnect was not able to establish a connection to the specified secure gateway解决办法
- OUI-67076 : OracleHomeInventory was not able to create a lock file" in Unix
- 设计模式_策略模式
- 让vim支持系统剪贴板
- Selenium学习笔记之008:多层frame或者windows定位
- python安装心得,以及MySQLdb的安装
- 关于上班第一天安装CocoaPod安装成功并使用的方法和感受
- Neither GenericXmlContextLoader nor AnnotationConfigContextLoader was able to detect defaults
- 变量及函数的生存期、作用范围、链接属性
- 游程编码
- JAVA基础之多线程
- UITabBar自定义方式三(中间有按钮)
- 一步一步学习网页开发之一
- 线程之从线程返回信息
- Hdu 2072 单词数【字符串】
- ZOJ 1048 Financial Management