springboot项目启动错误

tex 复制代码
** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.


2023-10-10 23:52:16.319  WARN 13036 --- [           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:\devloper\repository\org\springframework\boot\spring-boot-autoconfigure\2.6.3\spring-boot-autoconfigure-2.6.3.jar!/org/springframework/boot/autoconfigure/r2dbc/ConnectionFactoryConfigurations$PoolConfiguration.class]; nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryConfigurations$PoolConfiguration due to io/r2dbc/spi/ValidationDepth 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)
2023-10-10 23:52:16.330  INFO 13036 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-10-10 23:52:16.366 ERROR 13036 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:D:\devloper\repository\org\springframework\boot\spring-boot-autoconfigure\2.6.3\spring-boot-autoconfigure-2.6.3.jar!/org/springframework/boot/autoconfigure/r2dbc/ConnectionFactoryConfigurations$PoolConfiguration.class]; nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryConfigurations$PoolConfiguration due to io/r2dbc/spi/ValidationDepth 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)

因为使用了默认包进行了 @ComponentScan 扫描。默认情况下,Spring 只会扫描指定的包及其子包下的组件,如果没有指定任何包名,则默认扫描当前包及其子包下的所有组件。

将启动类放在一个包下即可。

相关推荐
仍然.3 分钟前
SpringBoot快速上手
java·spring boot·后端
ch.ju5 分钟前
Java程序设计(第3版)第四章——重载和覆盖的区别
java·开发语言
浮尘笔记10 分钟前
Go实现大文件异步流式采集引擎
开发语言·后端·golang
霸道流氓气质12 分钟前
Spring Boot 大数据量 Excel 导入导出功能实现指南
spring boot·后端·excel
仍然.17 分钟前
Spring MVC(1)---介绍Spring MVC 和 请求数据
java·spring·mvc
DianSan_ERP18 分钟前
架构师视角:电商大促高并发下的订单API限流与防漏单架构演进
java·运维·网络·安全·微服务·架构·自动化
云烟成雨TD19 分钟前
Agent Scope Java 2.x 系列【6】消息层
java·人工智能·agent
云烟成雨TD20 分钟前
Spring AI Alibaba 1.x 系列【74】Agentic RAG 与混合 RAG
java·人工智能·spring
小刘|22 分钟前
Spring AI 结构化输出 + 大模型参数全解(含千问调优)
java·后端·spring
云烟成雨TD23 分钟前
Spring AI Alibaba 1.x 系列【79】图执行生命周期的可观测性基础设施
java·人工智能·spring