Spring Boot啟動失敗 BeanDefinitionStoreException

初學(xué)Spring Boot,啟動時失?。?/p>

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

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/DataSourceAutoConfigurationJdbcTemplateConfiguration.class]; nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfigurationJdbcTemplateConfiguration 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)

CSDN小伙伴提出的解決方案:


查了半天終于才stack overflow上看到了解決方案,鏈接如下:stack overflow
是因為application.java 文件不能直接放在main/java文件夾下,必須要建一個包把他放進去

官方文檔有一小段說明:

14.1 Using the “default” Package

When a class does not include a package declaration, it is considered to be in the “default package”. The use of the “default package” is generally discouraged and should be avoided. It can cause particular problems for Spring Boot applications that use the @ComponentScan, @EntityScan, or @SpringBootApplicationannotations, since every class from every jar is read.

記錄一下學(xué)習(xí)中遇到的問題踩過的坑

作者:chaofansea
來源:CSDN
原文:https://blog.csdn.net/chaofansea/article/details/79025983?utm_source=copy
版權(quán)聲明:本文為博主原創(chuàng)文章,轉(zhuǎn)載請附上博文鏈接!

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,688評論 19 139
  • Spring Boot 參考指南 介紹 轉(zhuǎn)載自:https://www.gitbook.com/book/qbgb...
    毛宇鵬閱讀 47,285評論 6 342
  • SpringMVC原理分析 Spring Boot學(xué)習(xí) 5、Hello World探究 1、POM文件 1、父項目...
    jack_jerry閱讀 1,487評論 0 1
  • 入門 介紹 Spring Boot Spring Boot 使您可以輕松地創(chuàng)建獨立的、生產(chǎn)級的基于 Spring ...
    Hsinwong閱讀 17,101評論 2 89
  • =========================================================...
    lavor閱讀 3,656評論 0 5

友情鏈接更多精彩內(nèi)容