参考资料:

  http://www.mamicode.com/info-detail-2101273.html

  https://blog.csdn.net/u012834750/article/details/65942092

  

错误提示:

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package
// 警告:你的应用上下文可能没有启动,因为你将注解添加到了默认的package上面了

原因解析:

SpringBoot在写启动类的时候如果不使用@ComponentScan指明对象扫描范围,默认指扫描当前启动类所在的包里的对象,如果当前启动类没有包,则在启动时会报错:Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package错误。
因为启动类不能直接放在main/java文件夹下,必须要建一个包把它放进去或者使用@ComponentScan指明要扫描的包。

解决方法:

  方法一:在main/java下建个包,将Application文件放进去;

  方法二:在Application类上面加@ComponentScan注解,指定要扫描的包,如下:

@SpringBootApplication
@EnableEurekaClient
@ComponentScan(basePackageClasses = TestClass.class )
public class ClientDemoApplication {
public static void main(String[] args) {
SpringApplication.run(ClientDemoApplication.class, args);
}
}

    @ComponentScan(basePackageClasses=要扫描类.class所在位置的包)-意思是要扫描哪个类所在的包

  

  

Java问题解决:springboot启动出现-Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package的更多相关文章

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

  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. springboot 启动报错

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

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

  7. springboot 启动的java进程默默终止

    首先说明这是一个灵异事件......... 场景1 :把之前用map实现的缓存用Redis重构,高高兴兴上线更新,10 分钟后,老板告诉我,项目停了,what ??? 像我这么帅气,英俊,聪明的人,更 ...

  8. (四)SpringBoot启动过程的分析-预处理ApplicationContext

    -- 以下内容均基于2.1.8.RELEASE版本 紧接着上一篇(三)SpringBoot启动过程的分析-创建应用程序上下文,本文将分析上下文创建完毕之后的下一步操作:预处理上下文容器. 预处理上下文 ...

  9. (五)SpringBoot启动过程的分析-刷新ApplicationContext

    -- 以下内容均基于2.1.8.RELEASE版本 紧接着上一篇[(四)SpringBoot启动过程的分析-预处理ApplicationContext] (https://www.cnblogs.co ...

随机推荐

  1. .net 操作web.config文件

    XmlDocument doc = new XmlDocument(); string wc = HttpContext.Request.PhysicalApplicationPath + @&quo ...

  2. openssl源代码结构

    Openssl整个软件包主要包括三个主要的功能模块:密码算法库,SSL协议库,应用程序: 应用程序:主要包括密钥生成,证书管理,格式转换,数据加密,签名,SSL测试等. evp,对称算法,非对称算法, ...

  3. JavaScript之基础语法整理

    1.数据类型(number,boolean,string,null,undefined,symbol,object) es是动态语言,弱类型语言,虽然先声明了变量,但是变量可以重新赋值任意类型 弱类型 ...

  4. [游戏开发日志]Windows下Cocos2d-x 3.14环境搭建

    总介绍 我们小组使用的是cocos2d-x的游戏开发引擎,因此在所有开发工作之前,我们需要对这个引擎进行环境的搭建. 搭建过程 VS2013的下载和安装 VS只是作为一个开发环境而已,简单来说就是敲代 ...

  5. github文件上传与下载

    一.文件上传 ①.注册并登陆github,进入Github首页,点击New repository新建一个项目. ②.填写相应信息后点击create即可 Repository name: 仓库名称 De ...

  6. IIS + FastCGI+php(从5.2升级到5.3)

    由于PHP5.3 的改进,原有的IIS 通过isapi 方式解析PHP脚本已经不被支持,PHP从5.3.0 以后的版本开始使用微软的 fastcgi 模式,这是一个更先进的方式,运行速度更快,更稳定. ...

  7. flask框架----整合Flask中的目录结构

    一.SQLAlchemy-Utils 由于sqlalchemy中没有提供choice方法,所以借助SQLAlchemy-Utils组件提供的choice方法 import datetime from ...

  8. vxworks开发中simulator的使用之建立虚拟网卡

    在使用windriver workben ch开发vxWorks应用时,有时需要在本机上利用Simulator跑一下程序,这就需要你安装一个虚拟的网卡.vxWorks自带了这些工具,下面,以windo ...

  9. BIOS备忘录之SPI(fingerprint)设备

    Reset和INT信号使用的是GPIO功能,需要显式的使用(INT信号使用了GPIO的int number,RST信号使用了GPIO的absolute number): 问题举例 漏电导致功能异常:在 ...

  10. Linux查看当前目录下文件名中包含指定字符的文件

    find . -type f -name "edaijia* 结果: