当前位置: 首页 > news >正文

Spring-boot 启动时碰到的错误

错误提示

Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package

错误概述

最近学习springboot的使用,写了一个小demo,结果总是碰到这样的错误:

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.


2016-02-26 10:07:01.550  WARN 6112 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/C:/Users/cmc/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.5.RELEASE/spring-boot-autoconfigure-1.2.5.RELEASE.jar!/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$JdbcTemplateConfiguration.class]; nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration due to internal class not found. This can happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:303)
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:248)
    at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:140)
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266)
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:230)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:197)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:166)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:306)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94)
    ...

解决方法

查了半天终于才stack overflow上看到了解决方案,链接如下:stack overflow
是因为application.java 文件不能直接放在main/java文件夹下,必须要建一个包把他放进去

相关文章:

  • 开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(三)pnp4nagios安装
  • 利用Python进行文章特征提取(二)
  • 点击推送消息跳转处理(iOS)
  • 2.C#中泛型在方法Method上的实现
  • 简单的苗为课堂搜索版式编写《超链接》
  • 深入字节码 -- 计算方法执行时间
  • Building QT projects from the command line
  • http 状态码(转载)
  • 集成Diagram Viewer跟踪流程
  • PHP 7.0.4 Windows升级
  • 发现一个nginx LUA开发Web App的框架
  • golang笔记——string
  • 【转】Android Support v4、v7、v13的区别和应用场景
  • 【HDOJ】4326 Game
  • js 定义类对象
  • java多线程
  • Js基础知识(四) - js运行原理与机制
  • js写一个简单的选项卡
  • Lsb图片隐写
  • PyCharm搭建GO开发环境(GO语言学习第1课)
  • Spark VS Hadoop:两大大数据分析系统深度解读
  • vue从创建到完整的饿了么(18)购物车详细信息的展示与删除
  • 从零开始学习部署
  • 类orAPI - 收藏集 - 掘金
  • 如何优雅地使用 Sublime Text
  • 手机app有了短信验证码还有没必要有图片验证码?
  • 无服务器化是企业 IT 架构的未来吗?
  • 物联网链路协议
  • 鱼骨图 - 如何绘制?
  • 在GitHub多个账号上使用不同的SSH的配置方法
  • 做一名精致的JavaScripter 01:JavaScript简介
  • nb
  • 如何通过报表单元格右键控制报表跳转到不同链接地址 ...
  • ###项目技术发展史
  • #LLM入门|Prompt#1.7_文本拓展_Expanding
  • #NOIP 2014# day.2 T2 寻找道路
  • #我与Java虚拟机的故事#连载13:有这本书就够了
  • (动态规划)5. 最长回文子串 java解决
  • (二)PySpark3:SparkSQL编程
  • (教学思路 C#之类三)方法参数类型(ref、out、parmas)
  • (介绍与使用)物联网NodeMCUESP8266(ESP-12F)连接新版onenet mqtt协议实现上传数据(温湿度)和下发指令(控制LED灯)
  • (一)Neo4j下载安装以及初次使用
  • (转)EXC_BREAKPOINT僵尸错误
  • (转)自己动手搭建Nginx+memcache+xdebug+php运行环境绿色版 For windows版
  • (状压dp)uva 10817 Headmaster's Headache
  • .a文件和.so文件
  • .bashrc在哪里,alias妙用
  • .NET MVC第三章、三种传值方式
  • .NET/C# 编译期间能确定的相同字符串,在运行期间是相同的实例
  • .NET/C# 项目如何优雅地设置条件编译符号?
  • .net分布式压力测试工具(Beetle.DT)
  • [ 第一章] JavaScript 简史
  • [145] 二叉树的后序遍历 js
  • [BUG]Datax写入数据到psql报不能序列化特殊字符
  • [C#]winform使用引导APSF和梯度自适应卷积增强夜间雾图像的可见性算法实现夜间雾霾图像的可见度增强