Spring启动器 2 升级问题

Spring boot 2 upgrade issue with actuator

配置: spring云版本 = 'Finchley.SR1' springBootVersion = '2.0.2.RELEASE'

出现以下错误:

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

此版本 spring-starter-actuator-2.0.2.RELEASE 中没有 CounterService class? 参考:https://docs.spring.io/spring-boot/docs/2.0.2.RELEASE/api/

是的,SpringBoot 2.0中去掉了CounterService

我们遇到了同样的问题,我们使用千分尺的 MeterRegistry 而不是 CounterService

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

请参考迁移指南here