繁体   English   中英

Spring boot 不运行 ComponentScan

[英]Spring boot not run ComponentScan

无缘无故我无法启动 spring boot 应用程序导致此日志,我不知道在哪里修复它,我在应用程序注释上只有 baic SpringBootApplication 仅此而已,基本

在此处输入图片说明

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-02-25 20:54:39.204 ERROR 6404 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/C:/Users/petmik/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.0.BUILD-SNAPSHOT/spring-boot-autoconfigure-2.0.0.BUILD-SNAPSHOT.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/jdbc/datasource/embedded/EmbeddedDatabaseType 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)
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:454) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] .................

看来您还没有提到数据源配置。 Spring Boot 无法自动配置数据源。 为此,请使用 spring.datasource 前缀向 application.properties 添加一些属性。

有关您可以设置的所有属性,请参阅DataSourceProperties

您需要提供适当的 url 和驱动程序类名称:

 spring.datasource.url = …
 spring.datasource.driver-class-name = …

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM