![](/img/trans.png)
[英]Failed to deduce bean type for org.springframework.boot.actuate.autoconfigure.metrics.JvmMetricsAutoConfiguration.jvmHeapPressureMetrics
[英]No qualifying bean of type 'org.springframework.boot.actuate.metrics.MetricsEndpoint'
我将 spring.version 从 5.0.18.RELEASE 升级到 5.3.21
和 spring.boot.version 从 2.1.18.RELEASE 到 2.7.0
spring-boot-starter-actuator ${spring.boot.version}
在我的 Healthcheck 课程中,我使用:
@Autowired private MetricsEndpoint metrics;
升级后我有:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthcheck':
Unsatisfied dependency expressed through field 'metrics'; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'org.springframework.boot.actuate.metrics.MetricsEndpoint' available:
expected at least 1 bean which qualifies as autowire candidate.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
为什么 Spring 看不到 org.springframework.boot.actuate.metrics.MetricsEndpoint ?
2.1.18.RELEASE 到 2.7.0 是一个巨大的飞跃,所以正如评论所说,我建议仔细检查升级指南。
尽管如此,您需要在配置中公开指标端点,这将创建 bean。
management.endpoints.web.exposure.include: metrics
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.