Specify @BootstrapWith's 'value' attribute or make the default bootstrapper class available.
异常信息
java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @BootstrapWith's 'value' attribute or make the default bootstrapper class available.at org.springframework.test.context.BootstrapUtils.resolveTestContextBootstrapper(BootstrapUtils.java:144)at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:124)at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:151)at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:142)at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)at java.lang.reflect.Constructor.newInstance(Constructor.java:423)at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:36)at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.findAllMergedAnnotations(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Ljava/util/Set;at org.springframework.test.context.BootstrapUtils.resolveExplicitTestContextBootstrapper(BootstrapUtils.java:152)at org.springframework.test.context.BootstrapUtils.resolveTestContextBootstrapper(BootstrapUtils.java:127)... 18 more
场景描述
<properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><junit.version>4.10</junit.version><spring.version>4.2.3.RELEASE</spring.version></properties><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>${spring.version}</version></dependency><dependency><groupId>net.sf.ehcache</groupId><artifactId>ehcache</artifactId><version>2.10.3</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>5.1.5.RELEASE</version><scope>compile</scope></dependency>
异常原因
test的包是idea自动导入的,版本不一致。
解决方案
更改test的版本和项目的spring的一致
<dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>${spring.version}</version><scope>compile</scope></dependency>
参考资料
这里是引用
推荐阅读
●计算机教程汇总
●Java面试大全
●网站推荐
●软件推荐
●点击加入QQ群874514813交流学习,或获取更多资料
Specify @BootstrapWith's 'value' attribute or make the default bootstrapper class available.相关推荐
- 项目中出现specify @BootstrapWith‘s ‘value‘ attribute or make the default bootstrapper class avail
问题描述:在启动项目的时候控制台中报以下错误 specify @BootstrapWith's 'value' attribute or make the default bootstrapper c ...
- Could not load TestContextBootstrapper [null]. Specify @BootstrapWith‘s ‘value‘ attribute...
在测试redis集成短信验证时使用test启动类做单元测试,使用了spring注入. @RunWith(SpringRunner.class) @SpringBootTest(classes = Rb ...
- spring boot:java.lang.IllegalStateException异常
1.单元测试报错: java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @B ...
- junit4 javaee 5.0 jpa SSH 单元测试问题集锦
http://blog.csdn.net/wuqilianga/article/details/51295787 本篇文章基于已经实现了ssh集成的demo.项目.具体的ssh项目怎么配置,请参考本文 ...
- Spring Boot单元测试报错java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]
一:运行test类方法时候报错 报错 java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. S ...
- 报错 java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @Bootstra
由于我maven仓库之前已经有了有个5.0.10的test包 导致我的变量 <org.springframework.version>4.2.5.RELEASE</org.sprin ...
- Attribute Changer的几种形态
博文背景 Attribute Changer里面改变属性有好几种选项,找了很久资料终于知道他们的差别. 具体操作 总的来说,这个use saved有点儿类似于格式刷 Launching Attribu ...
- Spring boot Mybatis-Plus数据库单测实战(三种方式)
单元测试长久以来是热门话题,本文不会讨论需不需要写单测,可以看看参考资料1,我个人认为写好单测应该是每个优秀开发者必备的技能,关于写单测的好处在这里我就不展开讨论了,快速进入本文着重讨论的话题,如 ...
- Springboot单元测试mysql_Springboot Mybatis-Plus数据库单元测试实战(三种方式)
单元测试长久以来是热门话题,本文不会讨论需不需要写单测,可以看看参考资料1,我个人认为写好单测应该是每个优秀开发者必备的技能,关于写单测的好处在这里我就不展开讨论了,快速进入本文着重讨论的话题,如何写 ...
最新文章
- XShell连接Deepin
- 独家 | 从基础到实现:集成学习综合教程(附Python代码)
- 【5】青龙面板系列教程之Nolanjdc的安装【1月17作者删库,不用尝试了】
- 学生信息系统求助_Student Information Management -一个简单的学生信息管理系统(持续更新2)...
- Java通过FTP服务器上传下载文件的方法
- [PAT乙级]1022 D进制的A+B
- httpclient+Jsoup总结
- ora 27102 linux,ORA-27102: out of memory Linux-x86_64 Error: 12: Cannot allocate memory
- python执行命令不阻塞_Python 命令行非阻塞输入
- ubuntu下锐捷客户端连接校园网
- PDF虚拟打印机怎么保存文件
- 三菱伺服驱动器示例_MR-J4W3-B连接示例图/三菱伺服电机的组合
- 51单片机c语言轻松入门,单片机的C语言轻松入门资料
- UE源码版本下载编译全流程
- windows下安装openssl工具及生成pfx文件
- 01-交换机级联实验
- 强监管焕新外卖行业,美团、饿了么如何应对?
- 嵌入地图跳转高德地图_各种地图跳转导航
- ISO8583 报文协议
- python房价分析论文_用Python研究了三千套房子,告诉你究竟是什么抬高了房价?...