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

Quarkus中Redis缓存与Prometheus依赖冲突导致启动失败求助

问题排查与解决方案

问题根源

你的项目缺少Web服务器依赖,但配置中指定了quarkus.http.port且启用了Prometheus指标暴露(需要HTTP端点),同时quarkus-redis-cache引入了Vertx依赖,导致Micrometer的Vertx绑定在初始化HTTP指标时,找不到必要的HttpBinderConfiguration配置类,从而触发启动异常。


解决步骤

1. 添加Web服务器依赖

根据需求选择以下任一依赖添加到pom.xml:

  • 仅需基础HTTP服务器(用于暴露Prometheus指标):
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-vertx-http</artifactId>
    <version>3.2.8.Final</version>
</dependency>
  • 需要REST API支持(如开发业务接口):
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-resteasy-reactive</artifactId>
    <version>3.2.8.Final</version>
</dependency>

2. 优化版本管理(推荐)

避免硬编码每个Quarkus依赖的版本,使用Quarkus BOM统一管理版本,确保依赖版本一致:
在pom.xml的<dependencyManagement>中添加:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-bom</artifactId>
            <version>3.2.8.Final</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

之后所有Quarkus依赖可省略<version>标签,例如:

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-config-yaml</artifactId>
</dependency>

3. 验证修复

添加依赖后重新启动应用,HttpBinderConfiguration was not found异常应消失,同时可以访问配置的/metrics端点验证Prometheus指标是否正常暴露。


错误原因说明

  • quarkus-micrometer-registry-prometheus需要HTTP服务器来提供指标暴露的端点,但你的项目未引入任何Web服务器依赖。
  • quarkus-redis-cache引入Vertx依赖后触发了Vertx初始化流程,Micrometer的Vertx绑定尝试创建HTTP指标时,找不到Web服务器依赖提供的HttpBinderConfiguration,从而抛出异常。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.03 23:30:29