No qualifying bean of type MetricRegistry. Spring Boot 2

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();
}

If you still have any questions, feel free to ask me in the comments under this article, or write me on promark33@gmail.com.

If I saved your day, you can support me :)

Leave a Reply

Your email address will not be published.