Search code examples
spring-bootspring-boot-actuator

Spring boot 2 upgrade issue with actuator


Config: springCloudVersion = 'Finchley.SR1' springBootVersion = '2.0.2.RELEASE'

Getting below error:

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.actuate.metrics.CounterService

There is no CounterService class in this release of spring-starter-actuator-2.0.2.RELEASE?? Ref: https://docs.spring.io/spring-boot/docs/2.0.2.RELEASE/api/


Solution

  • Yes, CounterService is been removed in SpringBoot 2.0.

    We faced the same issue and we used MeterRegistry from micrometer instead of CounterService

        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
    

    Please refer migration guide here