springboot的常见问题错误
一:
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的常见问题错误的更多相关文章
- 【玩转SpringBoot】让错误处理重新由web服务器接管
其实web服务器是会处理错误的 在web.xml还是随处可见的年代时(确实有点老黄历了),下面的这些配置应该都不陌生. 根据错误代码处理错误,如下图01: 根据异常类型处理错误,如下图02: 不过我们 ...
- eclipse springboot运行helloworld错误: 找不到或无法加载主类 xxx.xxx.xxx
这个错误,在网上搜找了好久,说是什么jar包冲突,什么环境配置,我经过验证均是正确的,javac java java -version 都没问题,环境变量也OK,各种解释均没有能够解决我的问题,最后好 ...
- SpringBoot中自定义错误页面
错误页面定制(在有模板引擎的情况下): 有模板的支持下: 在templates文件夹下 建立 error文件夹 在error文件夹下 404.html 500.html 4xx.html (名字就叫4 ...
- 开发ffmpeg/live555常见问题错误及解决方法
#include <iostream>using namespace std;extern "C" {#include <libavcodec/avcodec.h ...
- SpringBoot(十五)-- 修改SpringBoot默认的错误页面
将以下代码放置到 main方法中.然后在resources 中的static中新建404.html.405.html,这里可以自定义错误编码,不局限于这两个. @Bean public Embedde ...
- SpringBoot 整合RabbitMQ错误记录
1. 控制台报错:Exception in thread "main" java.io.IOException…… Caused by: com.rabbitmq.client.S ...
- springboot连接redis错误 io.lettuce.core.RedisCommandTimeoutException:
springboot连接redis报错 超时连接不上 可以从以下方面排查 1查看自己的配置文件信息,把超时时间不要设置0毫秒 设置5000毫秒 2redis服务长时间不连接就会休眠,也会连接不上 重 ...
- springboot 运行出现错误 Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
原因是我将springboot启动类换到了另外一个方法中 出现了一个异常 后来发现因为我换了类但是忘记了换类名所以才报错 @ComponentScan @EnableAutoConfiguration ...
- springBoot中mybatis错误之 Property 'configuration' and 'configLocation' can not specified with together 解决
mybatis.config-location与mybatis.config-locations不同 mybatis.config-location不加载全局配置文件
随机推荐
- 手机网页制作教程META标签你知道多少?【转+加】
一.天猫 <title>天猫触屏版</title> <meta content="text/html; charset=utf-8" http-equ ...
- echo的运行
例子:编译.链接examples中的echo. 编译: g++ -c -I ~/build/release-install-cpp11/include echo.cc -std=c++11 g++ - ...
- 报错ERR_CONNECTION_REFUSED,如何解决(原创)
当我访问我的一个后天地址的时候,突然出现了ERR_CONNECTION_REFUSED,但是之前是可以访问的. 我先ping了下这个网址,发现是OK的 然后我想可能是80端口有问题,也就是说可能是WE ...
- Spring Cloud、Spring Boot与Docker 学习资料汇总
使用Spring Cloud与Docker实战微服务https://gitee.com/itmuch/spring-cloud-bookhttps://eacdy.gitbooks.io/spring ...
- .NetCore 下开发独立的(RPL)含有界面的组件包 (五)授权过滤参数处理
.NetCore 下开发独立的(RPL)含有界面的组件包 (一)准备工作 .NetCore 下开发独立的(RPL)含有界面的组件包 (二)扩展中间件及服 务 .NetCore 下开发独立的(RPL)含 ...
- string.format格式化字符串中转义大括号“{}”
今天,用Java读取配置文件占位符,使用String.Format(string format,object arg0)方法.以前只知“{0}”为索引占位符(即格式项),与参数列表中的第一个对象相对应 ...
- php7安装参数编译
系统:Centos6.8 软件包:php-7.0.14.tar.gz yum install bzip2 bzip2-devel -y yum install curl curl-devel -y y ...
- JMeter命令行监控CPU和内存资源
首先确定Agent启动成功 客户端
- 做生活的有心人——xxx系统第一阶段总结
2017秋,桃子已经步入大学三年级了,觉得格外幸运 因为现在,有了学习的动力. 如果你和我一样也是在大学中后部分才意识到,自己是个大人了,思维模式开始转变开始融入一些前所未有的认知,觉得自己渺小得如沧 ...
- Python 动态加载并下载"梨视频"短视频
下载链接:http://www.pearvideo.com/category_1 import requests from lxml import etree import re from urlli ...