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. 基于Grafana的监控数据钻取功能应用实践

    互联网企业中,随着机器规模以及业务量的爆发式增长,监控数据逐渐成为一种大数据,对监控大数据的分析,包括数据采集.数据缓存.数据聚合分析.数据存储.数据展现等几个阶段.不同阶段有不同的解决方案及支撑工具 ...

  2. AIOps 一场颠覆传统运维的盛筵

    "颠覆传统运维."是 OneAPM CEO 陈旭经常挂在嘴边的一句话.为什么说 AIOps 将颠覆传统运维?如何才能把人工智能和运维管理相结合并落地? 2018年5月,OneAPM ...

  3. Info.plist的CFBundleIdentifier、CFBundleName、BundleDisplayName

    plist关键字段: CFBundleIdentifier:应用包名.唯一标识 CFBundleVersion:文件版本号,可以每次发版本递增 CFBundleShortVersionString:a ...

  4. 洗礼灵魂,修炼python(52)--爬虫篇—【转载】爬虫工具列表

    与爬虫相关的常用模块列表. 原文出处:传送门链接 网络 通用 urllib -网络库(stdlib). requests -网络库. grab – 网络库(基于pycurl). pycurl – 网络 ...

  5. MySQL5.7 GTID学习笔记,[MySQL 5.6] GTID实现、运维变化及存在的bug

      GTID(global transaction identifier)是对于一个已提交事务的全局唯一编号,前一部分是server_uuid,后面一部分是执行事务的唯一标志,通常是自增的. 下表整理 ...

  6. [SequenceFile_3] MapFile

    0. 说明 MapFile 介绍 && 测试 1. 介绍 对 MapFile 的介绍如下: MapFile 是带有索引的 SequenceFile MapFile 是排序的 Seque ...

  7. [MapReduce_add_1] Windows 下开发 MapReduce 程序部署到集群

    0. 说明  Windows 下开发 MapReduce 程序部署到集群 1. 前提 在本地开发的时候保证 resource 中包含以下配置文件,从集群的配置文件中拷贝 在 resource 中新建  ...

  8. python redirect和render的区别

    render是渲染变量到模板中,而redirect是HTTP中1个跳转的函数,一般会生成302状态码.

  9. 3.4Python数据处理篇之Numpy系列(四)---ndarray 数组的运算

    目录 目录 (一)数组与标量的运算 1.说明: 2.实例: (二)元素级的运算(一元函数) 1.说明: 2.实例: (三)数组级的运算(二元函数) 1.说明: 2.实例: 目录 1.数组与标量的运算 ...

  10. JRE、JDK概述

    JRE(java Runtime Environment java运行环境) 包括java虚拟机(JVM Java Virtual Machine)和Java程序所需的核心类库等, 如果想要运行一个开 ...