java - 我应该怎么做才能使“io.micrometer.core.instrument.MeterRegistry”对象自动装配
问题描述
我正在尝试在构造函数中使用 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 自动装配的?我在这里缺少什么?
解决方案
您缺少执行器 jar: implementation("org.springframework.boot:spring-boot-starter-actuator")
推荐阅读
- scala - Dockerize Scala 应用程序:无法找到或加载主类
- ios - AVAssetExportSession - 如何从视频持续时间中修剪毫秒
- java - 将长数的每一位表示为列表的一个节点
- c# - 如何使用 Json.Net 将通用接口反序列化为通用具体类型?
- pandas - pandas:to_list 将时间戳存储为纪元。如何存储为iso格式的时间戳字符串
- javascript - 在浏览器中流式传输 FLV 视频
- reactjs - 使用react socket io和spring进行授权的websocket通信
- lua - 如何在罗技 G-Hub LUA 脚本或 AutoHotKey 中模拟罗技 G-Shift 键?
- python - 根据顺序数据对数据帧进行切片
- aws-lambda - 如何从存储库(而不是 s3 或本地目录)下载 lambda 包并使用 terraform 部署它