spring junit 做单元测试,报 Failed to load ApplicationContext 错误
spring junit 做单元测试,报 Failed to load ApplicationContext 错误。
查找了好一会,最后发现。@ContextConfiguration(locations = { "classpath:/spring/applicationContext.xml",
"classpath:/spring/app-config.xml", ……
改成
@ContextConfiguration(locations = { "classpath*:/spring/applicationContext.xml",
"classpath*:/spring/app-config.xml",
就好了。
可能是因为项目里引用了其他项目,有相同名称的spring配置文件导致的。在classpath后加上*就可以了。
如果以上未解决
可以尝试:Clean Project -> mvn install
spring junit 做单元测试,报 Failed to load ApplicationContext 错误的更多相关文章
- 小型SSM项目出现Failed to load ApplicationContext错误的解决方法(个人向)
使用单元测试的时候,出现了Failed to load ApplicationContext错误,在添加了一个新的Mapper.xml文件才出现的,在保证其他配置文件没有出错的情况下,检查mapper ...
- junit单元测试报错Failed to load ApplicationContext,但是项目发布到tomcat浏览器访问没问题
junit单元测试报错Failed to load ApplicationContext,但是项目发布到tomcat浏览器访问没问题,说明代码是没问题的,配置也没问题.开始时怀疑是我使用junit版本 ...
- spring集成Junit做单元测试及常见异常解决办法
spring-test依赖包 <!--Spring-test --> <!-- https://mvnrepository.com/artifact/org.springframew ...
- Junit 报错: Failed to load ApplicationContext
今天在使用Junit测试时候,报了个错误: Failed to load ApplicationContext, aspect not found;挺奇怪的 我又没有调用你,之前还好好的,现在不能使用 ...
- maven单元测试报java.lang.IllegalStateException: Failed to load ApplicationContext
报这个异常java.lang.IllegalStateException: Failed to load ApplicationContext的时候,通常是因为applicationContent.x ...
- spring中junit 提示Failed to load ApplicationContext
错误提示: 1:java.lang.IllegalStateException: Failed to load ApplicationContext 2:Error creating bean wit ...
- SpringBoot报错:Failed to load ApplicationContext(javax.websocket.server.ServerContainer not available)
引起条件: WebSocket+单元测试,单元测试报错! 解决方法: SpringBootTest增加webEnvironment参数. https://docs.spring.io/spring-b ...
- 集成JUnit测试错误java.lang.IllegalStateException: Failed to load ApplicationContext
1 详细错误信息 java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.t ...
- junit测试时,出现java.lang.IllegalStateException: Failed to load ApplicationContext
课程设计要求进行junit测试,我是在已经做好的ssh项目上做的测试,测试类代码如下 package com.zhang.web.services; import static org.junit.A ...
随机推荐
- Searching for Approximate Nearest Neighbours
Searching for Approximate Nearest Neighbours Nearest neighbour search is a common task: given a quer ...
- 什么是实时应用程序自我保护(RASP)?
什么产品可以定义为 RASP? RASP 英文为 Runtime application self-protection,它是一种新型应用安全保护技术,它将保护程序想疫苗一样注入到应用程序和应用程序融 ...
- Spring 配置XML文件头部文件格式
普通格式: <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns:xsi="ht ...
- easyui源码翻译1.32--ValidateBox(验证框)
前言 使用$.fn.validatebox.defaults重写默认值对象.下载该插件翻译源码 validatebox(验证框)的设计目的是为了验证输入的表单字段是否有效.如果用户输入了无效的值,它将 ...
- poj1141Brackets Sequence(dp+路径)
链接 dp好想 根据它定义的 记忆化下就行 路径再dfs一遍 刚开始以为要判空格 所以加了判空格的代码 后来知道不用 .. #include <iostream> #include< ...
- poj3254Corn Fields(状压)
http://poj.org/problem?id=3254 第一个状压题 思路挺好想 用二进制表示每行的状态 然后递推 用左移 右移来判断是不是01间隔出现 c大神教的 我的代码WA在这个地方了.. ...
- MapReduce架构设计
MapReduce采用Master/Slave的架构,其架构图如下: 它主要有以下4个部分组成: 1)Client 2)JobTracker JobTracke负责资源监控和作业调度.JobTrack ...
- 分享你最喜欢的技巧和提示(Xcode,Objective-C,Swift,C...等等)
http://www.cocoachina.com/ios/20151231/14846.html 笔者分享总结如下(本篇会不定期进行更新) : Objective-C 1.让Xcode的控制台支持L ...
- Apache FileUpload实现文件上传
今天,我来介绍一个Apache FileUpload这个插件的使用. 首先,到官网下载相关jar包点击这里下载,这里提供是v1.2. 1.在项目中导入相关jar包commons-fileupload- ...
- NameValueCollection类
最近在研究HttpRequest类,发现里面的很多属性都返回一个NameValueCollection对象,今天再来了解一下这个神秘的对象. 随便写了个例子,发现跟HashTable类似.但是这个东西 ...