资讯专栏INFORMATION COLUMN

Spring-boot 启动时碰到的错误

894974231 / 2917人阅读

摘要:错误提示错误概述最近学习的使用,写了一个小,结果总是碰到这样的错误解决方法查了半天终于才上看到了解决方案,链接如下是因为文件不能直接放在文件夹下,必须要建一个包把他放进去

错误提示
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文件夹下,必须要建一个包把他放进去

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/65542.html

相关文章

  • Spring-Boot学习笔记

    摘要:学习笔记使用很容易创建一个独立运行运行内嵌容器准生产级别的基于框架的项目,使用你可以不用或者只需要很少的配置。异常消息如果这个错误是由异常引起的。错误发生时请求的路径。 Spring-Boot 1.5 学习笔记 使用Spring Boot很容易创建一个独立运行(运行jar,内嵌Servlet容器)、准生产级别的基于Spring框架的项目,使用Spring Boot你可以不用或者只需要很...

    curlyCheng 评论0 收藏0
  • spring-boot登陆过滤功能

    摘要:工程除了提供后端的路由转发,还可以做全局的过滤器,所以我选择在这个工程里面写登陆校验功能。如果校验成功,返回登陆成功,否则,返回登陆失败。前端再根据登陆情况做路由跳转。登陆成功登陆失败最后,贴一下启动类的代码 先简单说一下我们工程的架构:前端工程是采用react,后端工程采用spring-cloud,里面分为zuul工程和其他功能模块。zuul工程除了提供后端的路由转发,还可以做全局的...

    taoszu 评论0 收藏0
  • 使用Docker部署Spring-Boot+Vue博客系统

    摘要:先来看一下容器的文件中间一些操作省略这里用了多阶段构建容器,如果直接通过设置环境变量只会在后面一个阶段生效,但是是在第一个阶段执行的,所以环境变量不能应用到当中。 在今年年初的时候,完成了自己的个Fame博客系统的实现,当时也做了一篇博文Spring-boot+Vue = Fame 写blog的一次小结作为记录和介绍。从完成实现到现在,也断断续续的根据实际的使用情况进行更新。 只不过每...

    Eirunye 评论0 收藏0
  • spring-boot-plus 常见问题解决 FAQ(十二)

    摘要:常见问题解决编译错误问题日志编译错误编译提示等日志错误解决检查是否安装插件安装安装运行错误问题错误不能连接解决检查服务是否启动检查地址和端口号未知数据库解决检查是否新建数据库默认的数据库为,可在不同环境的配置文件中更改例如中 spring-boot-plus 常见问题解决 FAQ 编译错误问题 log日志编译错误 编译提示log.info等日志错误 解决 检查是否安装lombok插件...

    RayKr 评论0 收藏0

发表评论

0条评论

894974231

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<