如何使用Kotlin协程实现ReactiveHealthIndicator?

问题描述

我正在尝试在Spring Boot 2.2 WebFlux应用程序中实现自定义ReactiveHealthindicator。

Spring文档中的example看起来像这样:

@Component
public class MyReactiveHealthindicator implements ReactiveHealthindicator {

    @Override
    public Mono<Health> health() {
        return doHealthCheck() //perform some specific health check that returns a Mono<Health>
            .onErrorResume(ex -> Mono.just(new Health.Builder().down(ex).build()));
    }

}

我想写这样的方法

override suspend fun health(): Health {
    // my code here
}

但是我收到“冲突重载”错误

是否有实现此目的的好方法

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)