Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package
1、在搭建SpringBoot框架时碰到的问题。
** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
警告:你的应用上下文可能没有启动,因为你将注解添加到了默认的package上面了。下面的堆栈信息中也有一句话包括了这个意思。
......This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)。
(启动的时候还有其他的错误,这里只摘录跟这个相关的错误。)
2、我的项目结构是这样的(我将Application的文件建在了java文件夹下面)

3、原因解析
我并没有使用@ComponentScanning注解,这里为什么会蹦出个这样的注解呢?
SpringBoot在编写启动类(Main方法所在的类)的时候如果不使用@ComponentScan指明对象扫描范围,默认指扫描当前启动类所在的包里的对象。
(注意:我在编写Main方法的时候并没有加@ComponentScan注解,因而,他会扫描Application所在的包里的对象)
如果当前启动类没有包,则在启动时会报错:Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package错误。
(注意:写在java文件夹下的Application类,是不从属于任何一个包的,因而启动类没有包)
4、解决办法
方法一、将Application建在其他的包下面
方法二、在Application类上面加@ComponentScan注解,指定要扫描的包

参考文档
http://blog.csdn.net/u012834750/article/details/65942092
Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package的更多相关文章
- Java问题解决:springboot启动出现-Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package
参考资料: http://www.mamicode.com/info-detail-2101273.html https://blog.csdn.net/u012834750/article/deta ...
- ** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
https://blog.csdn.net/qq_15071263/article/details/78459087 1. 警告解读 ** WARNING ** : Your ApplicationC ...
- 解决错误:Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
原因是代码直接放在默认包里边,比如src\main\java目录下 应该在src\main\java下建立子目录,比如src\main\java\com\test 这样的话,代码就在com.test这 ...
- Your ApplicationContext is unlikely to start due to a @ComponentScan of the default
问题:** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the defau ...
- Your ApplicationContext is unlikely tostart due to a @ComponentScan of the defau
一.错误提示: Your ApplicationContext is unlikely tostart due to a @ComponentScan of the default package.. ...
- springboot之HelloWorld
简介 为了简化开发Spring的复杂度,Spring提供了SpringBoot可以快速开发一个应用,这里就简单介绍下SpringBoot如何快速开发一个J2EE应用 HelloWorld 首先在gra ...
- Spring Boot踩坑之路一
Takes an opinionated view of building production-ready Spring applications. Spring Boot favors conve ...
- SpringBoot的HelloWorld 应用及解释
参考链接: Spring Data JPA - Reference Documentation Spring Data JPA--参考文档 中文版 纯洁的微笑:http://www.ityouknow ...
- springboot 启动报错
有一个警告 :** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the d ...
随机推荐
- JavaScript与正则表达式
正则表达式的定义 正则表达式与字符串对象相关的方法 相关示例 一.正则表达式(regular expression简称res) 1.定义: 一个正则表达式就是由普通字符以及特殊字符(称为元字符)组成 ...
- (网页)javascript如何用递归写一个简单的树形结构
转自博客园: 现在有一个数据,需要你渲染出对应的列表出来: var data = [ {"id":1}, {"id":2}, {"id":3 ...
- HttpClient与浏览器调用服务接口差异
我用httpclient访问接口,统计图有些不均匀,差距较大 ,有时只有几十毫秒,下图看到这种情况占多数,600-800毫秒之间的算是浏览器正常的产生调用接口的时间耗时 然后用jmeter跑时都是均值 ...
- Scrapy爬虫入门
1.安装Scrapy 打开Anaconda Prompt,执行:pip install Scrapy执行安装! 注意:要是安装过程中抛出: error: Microsoft Visual C++ 14 ...
- 洗礼灵魂,修炼python(11)--python函数,模块
前面的章节你如果看懂了,基本算是入门了七八了,不过如果你以为python就这么点东西,你觉得很简单啊,那你就错了,真正的东西在后面,前面我说的几大核心其实也不是多么高深多么厉害的,那些东西是基础很常用 ...
- Ext.net 3.1学习
主页面前台代码: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainF ...
- SQL SERVER利用BCP命令在命令行下导出数据到csv文件中
bcp "select * from (DBNAME).dbo.qt_trace where User_1 is not null" queryout c:\%date:~6,4% ...
- centos-7 虚拟机安装图形界面
centos-7 虚拟机安装图形界面 想到安装一个docker环境,于是拿出了以前装的虚拟机centos7,记得装完后,没进行任何配置(默认安装的是命令行界面). 配置网络 现有的虚拟机是没有办法联网 ...
- HTTP协议响应码及get请求和post请求比较
HTTP协议响应码 1XX:信息响应类,表示接收到请求并且继续处理 2XX:处理成功响应类,表示动作被成功接受.理解和接受 200 OK:表示从客户端发来的请求在服务器端被正常处理了 204 No C ...
- ubuntu服务器配置
首先设置Ubuntu更新源 https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ sudo cp /etc/apt/sources.list /etc/a ...