完整异常:

Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
无法找到@SpringBootConfiguration,您需要在测试中使用@ContextConfiguration或@SpringBootTest(classes=…)

问题产生的几种情况:

1.启动类 或者 程序入口类的包名和测试类所在包名不一致
例如:
启动类:com.leyou下的启动类
测试类:com.leyou.test下的测试类,“.test”多余

2.程序入口类忘了添加:SpringBootApplication注解

解决:

包名一致

单元测试报错:unable to find a @SpringBootConfiguration的更多相关文章

  1. delphi调试需要管理员权限程序报错“Unable to create process:请求的操作需要提升”

    delphi调试启动需要UAC权限的程序的时候会报错“Unable to create process:请求的操作需要提升”.这是因为delphi没有以管理员身份启动,这样delphi createp ...

  2. AS添加依赖报错Unable to merge dex

    AS添加依赖报错Unable to merge dex 最近在给项目添加依赖的时候,要给项目导入Bmob的SDK,参照Bmob的官方文档,可以直接在app的build.gradle文件中添加 //Bm ...

  3. centos6.5环境wget报错Unable to establish SSL connection

    centos6.5环境wget报错Unable to establish SSL connection [root@centossz008 src]# wget --no-check-certific ...

  4. linux 下通过xhost进入图形界面,经常会出现报错“unable to open display”

    linux 下通过xhost进入图形界面,经常会出现报错“unable to  open display” linux下的操作步骤如下: [root@localhost ~]# vncserver N ...

  5. git clone 报错Unable to negotiate with xxx.xxx.xxx.xxx port 12345: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

    在执行git clone命令报错 Unable to negotiate with xxx.xxx.xxx.xxx port 12345: no matching key exchange metho ...

  6. Git clone 报错 Unable to negotiate with xxx.xxx.xxx.xxx port 12345: no matching cipher found. Their offer: aes128-cbc,3des-cbc,blowfish-cbc

    git clone 报错 Unable to negotiate with xxx.xxx.xxx.xxx. port 12345: no matching cipher found. Their o ...

  7. C# 解决SharpSvn启动窗口报错 Unable to connect to a repository at URL 'svn://....'

    在远程机打开sharpsvn客户端测试,结果报错 Svn启动窗口报错 Unable to connect to a repository at URL 'svn://...' 咋整,我在win10我的 ...

  8. CentOS7图形界面启动报错unable to connect to X server

    以前还可以正常启动图形界面,这次启动失败,报错unable to connect to X server 使用的是oracle用户,因为我是在oracle用户下创建的oracle数据库等 解决办法: ...

  9. 单点登录(十一)-----遇到问题-----cas启用mongodb验证方式报错--Unable to locate Spring NamespaceHandler for XML schema na

    cas启用mongodb验证方式报错--Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.sp ...

  10. selenium+phantomjs报错:Unable to find a free port的分析和解决

    selenium+phantomjs报错:Unable to find a free port的分析和解决 Table of Contents 1. 现象 2. 分析 3. 解决办法 1 现象 在做项 ...

随机推荐

  1. max=(a>b)?a:b;

    这个函数的意思是如果a>b,max=a:否则max=b. 实际程序: while ((__HAL_UART_GET_FLAG(huart, Flag) ? SET : RESET) == Sta ...

  2. Windows Server 2012 R2 自动映射公共网络驱动器

    1.创建组织单位,在组织单位新建用户或者组 2.新建文件夹(名字无所谓,我这里起名一样方便测试) 3.对文件夹开启共享,设置要共享的用户或者组 4.打开组策略,找到对应的组织单位 5.创建GPO 6. ...

  3. Django - Form嵌套的Meta类 + 为什么type()能创建类

    Form里面嵌套了一个Meta类 class PostForm(forms.ModelForm): class Meta: model = Post # field to be exposed fie ...

  4. leetcode菜鸡斗智斗勇系列(8)--- Find N Unique Integers Sum up to Zero

    1.原题: https://leetcode.com/problems/find-n-unique-integers-sum-up-to-zero/ Given an integer n, retur ...

  5. Webflux是什么东东

    转自:百家号-薇薇心语 各位Javaer们,大家都在用SpringMVC吧?当我们不亦乐乎的用着SpringMVC框架的时候,Spring5.x又悄(da)无(zhang)声(qi)息(gu)的推出了 ...

  6. Sqlmap 工具用法详解

    Sqlmap 工具用法详解                                 sqlmap是一款自动化的sql注入工具.     1.主要功能:扫描.发现.利用给定的url的sql注入漏 ...

  7. 压力测试-apachebench

    压力测试-apachebench 1.      压力测试 压力测试的概念\定义: 性能测试Performance Test :是指通过自动化的测试工具模拟多种正常.峰值以及异常负载条件来对系统的各项 ...

  8. 配置 DNS

    配置 DNS 如何自定义配置容器的主机名和 DNS 呢?秘诀就是 Docker 利用虚拟文件来挂载容器的 3 个相关配置文件. 在容器中使用 mount 命令可以看到挂载信息: $ mount /de ...

  9. 需要写的CSS博客

    重绘与回流 BFC 水平垂直居中 定位 基线各种线 inline-block,img标签空字符

  10. Cat4500升级注意事项

    第一部分:升级ROMMON 可以通过release note去查看什么Supervisor建议什么样的版本.例如:ROMMON Release Notes for the WS-X45-SUP7-E, ...