MetricRegistry bean error


What's inside this article ⌄
  • Spring Boot metricregistry bean error
  • No qualifying bean metricregistry
  • Spring Boot 2 metrics configuration
  • Spring Boot metrics bean missing

Full text exception text:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.codahale.metrics.MetricRegistry] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.

Spring Boot 2 is no longer support MetricsRegistry by default.

If you want to continue using the MetricsRegistry for your own purposes, just create a new bean:

@Bean
public MetricRegistry metricRegistry() {
    return new MetricRegistry();
}