使用IDEA创建springboot项目时,报错
** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
2019-07-19 18:08:20.113 WARN 7284 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/D:/Program%20Files%20(x86)/apache-maven-3.6.1-bin/mavenWarehouse/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.4.RELEASE/spring-boot-autoconfigure-2.0.4.RELEASE.jar!/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$EmbeddedDatabaseConfiguration.class]; nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseConfiguration due to org/springframework/dao/DataAccessException not found. Make sure your own configuration does not rely on that class. This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
发现是因为是启动类application.java 不能直接放在main/java文件夹下,必须要建一个包把他放进去,如main/java/com/example下;