一:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name

2019-03-08 16:07:14.132 ERROR 9936 --- [ main] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@2f7c2f4f] to prepare test instance [com.example.demo.DemoApplicationTests@5491f68b]

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.example.demo.DemoApplicationTests': Unsatisfied dependency expressed through field 'person'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.beans.Person' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation

是因为测试的application类访问不到autowired注解的属性的对象所在的包。

application只能访问同一包下的文件,或者是同一包下的子文件

二:

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

是因为application和junit所在的包名不一样导致

三:是因为yml文件中存在tab键等yml文件有问题

java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'

springboot的常见问题错误的更多相关文章

  1. 【玩转SpringBoot】让错误处理重新由web服务器接管

    其实web服务器是会处理错误的 在web.xml还是随处可见的年代时(确实有点老黄历了),下面的这些配置应该都不陌生. 根据错误代码处理错误,如下图01: 根据异常类型处理错误,如下图02: 不过我们 ...

  2. eclipse springboot运行helloworld错误: 找不到或无法加载主类 xxx.xxx.xxx

    这个错误,在网上搜找了好久,说是什么jar包冲突,什么环境配置,我经过验证均是正确的,javac java java -version 都没问题,环境变量也OK,各种解释均没有能够解决我的问题,最后好 ...

  3. SpringBoot中自定义错误页面

    错误页面定制(在有模板引擎的情况下): 有模板的支持下: 在templates文件夹下 建立 error文件夹 在error文件夹下 404.html 500.html 4xx.html (名字就叫4 ...

  4. 开发ffmpeg/live555常见问题错误及解决方法

    #include <iostream>using namespace std;extern "C" {#include <libavcodec/avcodec.h ...

  5. SpringBoot(十五)-- 修改SpringBoot默认的错误页面

    将以下代码放置到 main方法中.然后在resources 中的static中新建404.html.405.html,这里可以自定义错误编码,不局限于这两个. @Bean public Embedde ...

  6. SpringBoot 整合RabbitMQ错误记录

    1. 控制台报错:Exception in thread "main" java.io.IOException…… Caused by: com.rabbitmq.client.S ...

  7. springboot连接redis错误 io.lettuce.core.RedisCommandTimeoutException:

    springboot连接redis报错 超时连接不上  可以从以下方面排查 1查看自己的配置文件信息,把超时时间不要设置0毫秒 设置5000毫秒 2redis服务长时间不连接就会休眠,也会连接不上 重 ...

  8. springboot 运行出现错误 Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

    原因是我将springboot启动类换到了另外一个方法中 出现了一个异常 后来发现因为我换了类但是忘记了换类名所以才报错 @ComponentScan @EnableAutoConfiguration ...

  9. springBoot中mybatis错误之 Property 'configuration' and 'configLocation' can not specified with together 解决

    mybatis.config-location与mybatis.config-locations不同 mybatis.config-location不加载全局配置文件

随机推荐

  1. 蓝桥杯  历届试题 幸运数  dfs

    历届试题 幸运数 时间限制:1.0s   内存限制:256.0MB 问题描述 幸运数是波兰数学家乌拉姆命名的.它采用与生成素数类似的"筛法"生成 . 首先从1开始写出自然数1,2, ...

  2. 51Nod 1298 圆与三角形(计算几何)

    1298 圆与三角形  基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 给出圆的圆心和半径,以及三角形的三个顶点,问圆同三角形是否相交.相交输出"Yes&quo ...

  3. lsattr chattr 文件安全设置

    [root@test_android_client_download xianlaigames]# lsattr -------------e- ./jilinmj.apk[root@test_and ...

  4. JVM 方法区内存扩大 以及开启GC

    因为应用使用了OSGi框架,<深入理解JAVA虚拟机>中对使用OSGi时可能产生的方法区溢出有所描述 第一部分: 第二部分 可见,OSGi会动态生成大量Class,在OSGi中,即使是同一 ...

  5. Quartz.net入门

    简介 Quartz.NET是一个开源的作业调度框架,是OpenSymphony的 Quartz API的.NET移植,它用C#写成,可用于winform和asp.net应用中.它提供了巨大的灵活性而不 ...

  6. Android Studio运行项目报错:Error:null value in entry: annotationProcessorOutputFolder=null的解决方案

    一般是在Android studio异常退出(比如强制关机)后,重新打开后运行项目出现该问题. 解决方案 删除项目根目录的.gradle文件夹,然后Clean  Project —— Rebulid ...

  7. Java集合源码学习(三)LinkedList

    前面学习了ArrayList的源码,数组是顺序存储结构,存储区间是连续的,占用内存严重,故空间复杂度很大.但数组的二分查找时间复杂度小,为O(1),数组的特点是寻址容易,插入和删除困难.今天学习另外的 ...

  8. tomcat多端口配置

    <?xml version="1.0" encoding="UTF-8"?> <Server port="8005" sh ...

  9. Java03动手动脑

    1.当JAVA里定义的函数中去掉static后,怎么办? static代表静态,由于main函数是静态的,如果自己定义的函数方法加了static则在类加载时就一起加载了.但如果不写static,就必须 ...

  10. quratz数据存储

    Quartz 中的 trigger 和 job 需要存储下来才能被使用. 1.两种存储方式 RAMJobStore, JobStoreSupport, 其中 RAMJobStore 是将 trigge ...