我将spring.version从5.0.18升级到5.3.21
和spring.boot.version从2.1.18降至2.7.0
弹簧-启动-启动-执行器${spring.boot.version}
在我的健康检查课上,我使用:
@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?
发布于 2022-06-24 08:26:51
2.1.18. upgrade到2.7.0是一个巨大的飞跃,因此正如评论中所说的,我建议仔细检查升级指南。
不过,您需要在配置中公开度量端点,这将创建bean。
management.endpoints.web.exposure.include: metricshttps://stackoverflow.com/questions/72740483
复制相似问题