在对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. Yii Model

    REFs 自动生成代码 创建第一个Yii应用 创建模型 Yii 用户登陆机制

  2. 为Python编写一个简单的C语言扩展模块

    最近在看pytorh方面的东西,不得不承认现在这个东西比较火,有些小好奇,下载了代码发现其中计算部分基本都是C++写的,这真是要我对这个所谓Python语音编写的框架或者说是库感觉到一丢丢的小失落,细 ...

  3. yaf路由配置规则

    使用框架的默认路由来访问的时候,会遇到一些困扰,这部分无法查看源代码,只能通过猜测来分析. 如果项目有多个模块,显然使用yaf的默认的静态路由是无法满足需求的. yaf默认的配置是着这样的: appl ...

  4. I.MX6 Manufacturing Tool V2 (MFGTool2) ucl2.xml hacking

    <!-- * Copyright (C) 2010-2013, Freescale Semiconductor, Inc. All Rights Reserved. * The CFG elem ...

  5. 【转】Python 中的 if __name__ == '__main__' 该如何理解

    转自:http://blog.konghy.cn/2017/04/24/python-entry-program/ 程序入口 对于很多编程语言来说,程序都必须要有一个入口,比如 C,C++,以及完全面 ...

  6. 固件_Linux内核

    1.相关函数 .相关函数 int request_firmware_nowait( struct module *module, bool uevent, const char *name, stru ...

  7. fb远程连接服务器调试,碉堡了

    开发中经常碰到本地代码没问题,上传到服务器上就有有问题, 这个时候调试变的很麻烦,放个textField自己保存日志这种方式调试的都是. 今天刚学了远程连接服务器,adobe真是牛逼坏了啊. 新增一个 ...

  8. 【转】Vim自动补全插件----YouCompleteMe安装与配置

    原文网址:http://www.cnblogs.com/zhongcq/p/3630047.html 使用Vim编写程序少不了使用自动补全插件,在Linux下有没有类似VS中的Visual Assis ...

  9. Windows 无法安装到所选位置。错误:0x80300001

    Windows 无法安装到所选位置.错误:0x80300001 这里遇到的情况是这样的,iDrac安装windows 2008 R2,一开始映射 windows 2008 R2系统镜像,后来,阵列驱动 ...

  10. dig命令使用大全

    https://www.cnblogs.com/daxian2012/archive/2013/01/10/2854126.html 译者序:可以这样说,翻译本篇文档的过程就是我重新学习DNS的过程, ...