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不加载全局配置文件
随机推荐
- python 内建函数
# # __geratteibute__class Itcast(object): def __init__(self,subject1): self.subject1 = subject1 self ...
- 通过ModelForm实现主机添加和编辑
通过ModelForm实现主机添加和编辑 ModelForm这是一个神奇的组件,通过名字我们可以看出来,这个组件的功能就是把model和form组合起来:在使用Model和Form时,都需要对字段进行 ...
- CTAP: Complementary Temporal Action Proposal Generation (ECCV2018)
互补时域动作提名生成 这里的互补是指actionness score grouping 和 sliding window ranking这两种方法提proposal的结合,这两种方法各有利弊,形成互补 ...
- 【UOJ 209】【UER #6】票数统计
题解: jls的题目还是比较好的 首先比较显然我们可以分析出 当x<y时,显然只能满足前缀条件 针对这一档部分分,是个简单的组合数 考虑一下后缀限制,发现真的不好搞.. 看了题解发现,枚举总共的 ...
- Nginx配置项优
1.nginx运行工作进程个数,一般设置cpu的核数或者核心数x2 如果不了解cpu的核数,可以top命令之后按1看出来,也可以查看/proc/cpuinfo文件. [root@localhost~] ...
- 开源CMS系统Moodle对比中国本土化开源在线教育平台EduSoho
这段时间研究了一下著名的开源课程管理系统Moodle,也了解了一下目前国内比较火的在线教育平台EduSoho,发现二者有诸多相似之处,但优势各异.接下来就简单对着两个平台做一下对比. 首先来说一下Ed ...
- 使用sparkSQL的insert操作Kudu
可以选择使用Spark SQL直接使用INSERT语句写入Kudu表:与'append'类似,INSERT语句实际上将默认使用UPSERT语义处理: import org.apache.kudu.sp ...
- ubuntu镜像下载地址
下载地址: http://mirror.pnl.gov/releases/xenial/ Ubuntu 14.04.5 LTS (Trusty Tahr)http://releases.ubuntu. ...
- .netcore加入APM系统 SkyWalking
安装环境:windows 2016 必要条件: JDK8+ Elasticsearch 5.x(注:目前不支持es6) 8080,10800,11800,12800 端口不被占用 下载skywalki ...
- Codeforces 919D Substring 【拓扑排序】+【DP】
<题目链接> 题目大意:有一个具有n个节点,m条边的有向图,每个点对应一个小写字母,现在给出每个顶点对应的字母以及有向边的连接情况,求经过的某一条路上相同字母出现的最多次数.如果次数无限大 ...