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的更多相关文章

  1. 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 ...

  2. ** 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 ...

  3. 解决错误: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这 ...

  4. 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 ...

  5. 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.. ...

  6. springboot之HelloWorld

    简介 为了简化开发Spring的复杂度,Spring提供了SpringBoot可以快速开发一个应用,这里就简单介绍下SpringBoot如何快速开发一个J2EE应用 HelloWorld 首先在gra ...

  7. Spring Boot踩坑之路一

    Takes an opinionated view of building production-ready Spring applications. Spring Boot favors conve ...

  8. SpringBoot的HelloWorld 应用及解释

    参考链接: Spring Data JPA - Reference Documentation Spring Data JPA--参考文档 中文版 纯洁的微笑:http://www.ityouknow ...

  9. springboot 启动报错

    有一个警告 :** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the d ...

随机推荐

  1. 在Visualforce页面中使用Visual Flow

    在本文中,我们将通过一个示例说明如何将"流"(Visual Flow)用于Visualforce页面. 更全面的知识可以参考官方文档. 创建流 我们要创建一个流,它的作用是得到一个 ...

  2. ActiveReports公开课开启报名,学习如何解决中国式复杂报表难题

    ActiveReports实战教学 90分钟解决中国式复杂报表六大需求 [开课时间]4月19日 [主讲老师]葡萄城资深报表专家 [培训方式]网络在线公开课 报名地址

  3. 使用 Java 8 语言功能

    Android Studio 3.0 及以上版本支持所有 Java 7 语言功能,以及部分 Java 8 语言功能(具体因平台版本而异). 本页介绍您可以使用的 Java 8 语言功能.如何正确配置项 ...

  4. OkHttp封装之后使用

    代码都封装好了,上层Activity如何调用呢? 1.依赖 如果是android studio开发支持在线依赖(我已经把项目添加到jcenter上): compile 'com.ansen.http: ...

  5. [iOS]多线程和GCD

    新博客wossoneri.com 进程和线程 进程 是指在系统中正在运行的一个应用程序. 每个进程之间是独立的,每个进程均运行在其专用且受保护的内存空间内. 比如同时打开QQ.Xcode,系统就会分别 ...

  6. Fiddler抓包使用教程-基本功能介绍

    转载请标明出处:http://blog.csdn.net/zhaoyanjun6/article/details/72932886 本文出自[赵彦军的博客] Fiddler 基本页面 会话列表功能介绍 ...

  7. Redis系列(一):Redis的简介与安装

    原文链接(转载请注明出处):Redis系列(一):Redis的简介与安装 什么是 Redis Redis 是一个使用ANSI C 编写的开源.支持网络协议.基于内存.可选持久性的键值对数据库,它是一个 ...

  8. python redis 终端 redis-cli.py mini版本 redis 终端管理工具

    Python redis-cli.py Python3 redis-cli 命令行管理工具 redis终端工具 由于最近测试redis未授权访问漏洞,发现本机没有安装redis,不能运行redis-c ...

  9. if语句的嵌套以及条件运算符和条件表达式(初学者)

    1.当if语句中的执行语句又是if语句时,则构成了if语句的嵌套情形. 其一般形式可表示为: if() { if()……; } 或: if() if()语句1: else 语句2: else if() ...

  10. 17秋 软件工程 第六次作业 Beta冲刺 Scrum2

    17秋 软件工程 第六次作业 Beta冲刺 Scrum2 我们组转会成员:杰麟: 我们组新成员:宏庆. 各个成员冲刺期间完成的任务 世强:完成分页功能的演示: 陈翔:完成超级管理员后端login模块: ...