在对SpringBoot进行单元测试时,报错“Could not load TestContextBootstrapper [null]”

错误原因:

Maven的pom.xml中某些SpringBoot或Spring的依赖的版本有冲突

解决方法:

将冲突的依赖包版本修改为一致即可。

示例如下:

将SpringBoot的测试依赖包改为一致就可以了。

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<version>1.5.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.5.7.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<version>1.5.7.RELEASE</version>
<scope>test</scope>
</dependency> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency> <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.12.RELEASE</version>
</dependency> </dependencies>

Could not load TestContextBootstrapper [null]的更多相关文章

  1. Spring Boot单元测试报错java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]

    1 报错描述 java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @Boot ...

  2. java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @BootstrapWith's 'value' attribute or make the default bootstrapper class available.

    1.前几天搭建单元测后,今天用其测试,结果报了这个问题.网上搜索后,刚开始以为原因是  Spring的 依赖版本的问题,我现在的依赖是: 因为其他的比如说 spring-content  spring ...

  3. 力扣 报错 runtime error: load of null pointer of type 'const int'

    runtime error: load of null pointer of type 'const int' 要求返回的是int* 解决方案 1.指针使用malloc分配空间 用 int * p = ...

  4. [踩坑记录] runtime error: load of null pointer of type 'const int' (leetcode)

    leetcode上面做题遇到的错误 原因: 在调用函数时,如果返回值如果是一个常量则没问题.如果返回值若为指针则可能会出现该错误,假如返回的指针地址指向函数内的局部变量,在函数退出时,该变量的存储空间 ...

  5. junit4 javaee 5.0 jpa SSH 单元测试问题集锦

    本篇文章基于已经实现了ssh集成的demo.项目.具体的ssh项目怎么配置,请参考本文最后 spring环境下的JUnit4测试 1,下载所需jar包: spring-test-3.2.0.RELEA ...

  6. spring整合redis(jedis)

    真是一步一个坑阿,学点新技术,这么难,这个异常: java.lang.IllegalStateException: Could not load TestContextBootstrapper [nu ...

  7. Ext中Grid重新load设置URL

    一.前言    Extjs中grid网格有时候需要重新加载,加载的时候对应不同的URL,什么情况出现:有需要我们在添加附件的时候,添加完成了附件,需要把另一个show添加的数据重新加载到grid中,而 ...

  8. mysql 变量is null 和 not exists区别

    问题: 使用游标遍历时,发现使用 select var into tmp where var=? 然后判断if tmp is null时,不能走完所有的遍历.经debug发现, 当var为空时,则跳出 ...

  9. MySQL :: MySQL 8.0 Reference Manual :: B.6.4.3 Problems with NULL Values https://dev.mysql.com/doc/refman/8.0/en/problems-with-null.html

    MySQL :: MySQL 8.0 Reference Manual :: B.6.4.3 Problems with NULL Values https://dev.mysql.com/doc/r ...

随机推荐

  1. JDK配置 java跨平台性

    jdk 虚拟机jre 依赖包javac 编译java 运行JAVA_HOME 一个存储jdk路径的自定义的变量,方便其他地方配置以后更改方便其他地方调用JAVA_HOME使用%JAVA_HOME%配置 ...

  2. Java 复制一个文件到另外一个目录下

    因为项目部署在jboss上面,在上传一些图片的时候,把他上传到当前项目的下,比如:(这里是以Windows服务器为例的,当然linux也是一样的) D:\jboss-eap-6.4\domain\se ...

  3. timer Compliant Controller project (2)--Project Demonstration

    1software flow diagram     As we know, Embedded design is the core of  Electronic Product Design. Di ...

  4. Linux:提示符PS1个性设置

    提示符PS1个性设置 1)默认PS1 echo $PS1 2)个性PS1 #去掉了默认显示的[]号#\e[1;34m\]\u:user名高亮显示并显示颜色#\e[5;33m\]\h:hostname主 ...

  5. Cause: org.postgresql.util.PSQLException: ERROR: cached plan must not change result type的前因后果

    首先说明一下遇到的问题: PG数据库,对其中的某张表增加一列后,应用报错,信息如下: 应用使用相关框架如下:SpringBoot.MyBatis. ### Cause: org.postgresql. ...

  6. js网页 唤醒支付宝

    过渡页: <script> window.location.href = 'alipays://platformapi/startApp?appId=10000011&url=al ...

  7. HDU 1285:确定比赛名次(拓扑排序)

    确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  8. 使用LINQ获取List列表中的某个字段值

    使用LINQ获取列表中的某个字段值,下面以获取员工列表中的编号字段为例子. 1.使用Select方法 List<Emplayee> emplayeeList = GetEmplayeeLi ...

  9. 6-18 Two Stacks In One Array(20 分)

    Write routines to implement two stacks using only one array. Your stack routines should not declare ...

  10. 增强型for和Iterator学习

    1,增强for和对于非集合类(没有实现 Iterable接口)的数组遍历效果一样 2,对于集合类,就是隐式调用迭代器 iterator的遍历,各有各个场合 3,对于arraylist来所,由于数据结构 ...