【问题标题】:what should I do to make "io.micrometer.core.instrument.MeterRegistry" object autowired我应该怎么做才能使“io.micrometer.core.instrument.MeterRegistry”对象自动装配
【发布时间】:2021-03-30 11:10:12
【问题描述】:

我正在尝试在构造函数中使用 MeterRegistry 对象,但 Intelij 向我显示了一条消息 Could not autowire. No beans of 'MeterRegistry' type found.

我正在使用这个依赖:

implementation group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.3.5'

我在 application.properties 文件中有这些属性

management.endpoint.metrics.enabled=true
management.endpoints.web.exposure.include=*
management.endpoint.prometheus.enabled=true
management.metrics.export.prometheus.enabled=true

所以我想知道为什么 Spring 没有自动装配它?我在这里缺少什么?

【问题讨论】:

    标签: java spring prometheus


    【解决方案1】:

    您缺少执行器 jar: implementation("org.springframework.boot:spring-boot-starter-actuator")

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多