初學(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 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)載請附上博文鏈接!