执行器的 Spring Boot 2 升级问题

问题描述:

配置:springCloudVersion = 'Finchley.SR1'springBootVersion = '2.0.2.RELEASE'

Config: springCloudVersion = '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 类??参考:https://docs.spring.io/spring-boot/docs/2.0.2.RELEASE/api/

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/

是的,CounterService 在 SpringBoot 2.0 中被移除了.

Yes, CounterService is been removed in SpringBoot 2.0.

我们遇到了同样的问题,我们使用了来自 micrometer 的 MeterRegistry 而不是 CounterService

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>

请参考迁移指南 这里