You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot从2升级到3.1.1无法导入ElasticSearchRestHealthContributorAutoConfiguration

解决Spring Boot 3.1.1无法导入ElasticsearchRestHealthContributorAutoConfiguration的问题
  • 先检查类名拼写:你写的ElasticSearchRestHealthContributorAutoConfiguration里的ElasticSearch是错误的,Spring Boot 3.x里这个类的正确名称是ElasticsearchRestHealthContributorAutoConfiguration(注意是全小写的elasticsearch,没有大写的S),修正拼写后再尝试导入。

  • 确认依赖是否齐全:
    这个类属于actuator模块,必须确保项目中引入了spring-boot-starter-actuator,同时需要Elasticsearch相关的客户端依赖(比如spring-boot-starter-data-elasticsearch),两者缺一不可。

  • 核对依赖配置:
    Maven项目可以参考以下配置:

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        </dependency>
    </dependencies>
    

    Gradle项目参考:

    dependencies {
        implementation 'org.springframework.boot:spring-boot-starter-actuator'
        implementation 'org.springframework.boot:spring-boot-starter-data-elasticsearch'
    }
    
  • 清理缓存并重构项目:
    执行mvn clean install(Maven)或gradle clean build(Gradle),然后刷新IDE的依赖索引,避免缓存导致的依赖加载问题。

内容的提问来源于stack exchange,提问作者Lareina

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 19:10:01