Anil Maddukuri
Anil Maddukuri

Reputation: 713

required a bean of type 'io.micrometer.core.instrument.MeterRegistry' that could not be found

Recently we upgraded spring-boot version to 2.7.2 and spring framework version to 5.3.22. Since then we are seeing this error in one of the apps

"required a bean of type 'io.micrometer.core.instrument.MeterRegistry' that could not be found."

Spring documentation says that if there is a dependency called micrometer-registry-<?> then it will autowire the required MeterRegistry. We do have that dependency in out project. But it is not happening.

We do have the following properties in application.yml. But actuator is also not working

management:
  metrics:
    export:
      statsd:
        enabled: true
        flavor: datadog
        host: localhost
        port: 8125
  endpoints:
    web:
      exposure:
        include: "*"
  metrics:
    enabled: true

Can some one please tell me what i am missing here?

Upvotes: 7

Views: 16203

Answers (3)

Barun
Barun

Reputation: 1622

If the below config is false

management.metrics.export.graphite.enabled=false

And you have MeterRegistryCustomizer beans defined, you will get this error

SimpleMeterRegistry cannot be cast to class io.micrometer.graphite.GraphiteMeterRegistry

Resolution:

Set to true

management.metrics.export.graphite.enabled=true

Upvotes: 0

korolkevich7
korolkevich7

Reputation: 1

You have problem with your configuration, because of double "management.metrics". Move metrics.enabled in the first block.

Upvotes: 0

Jonatan Ivanov
Jonatan Ivanov

Reputation: 6843

You need spring-boot-starter-actuator on your classpath.

Upvotes: 13

Related Questions