【发布时间】:2021-08-24 02:48:52
【问题描述】:
我想运行一个周期性任务。在 Spring MVC 中它完美地工作。
现在我想集成 Spring Webflux + Kotlin Coroutines。
如何在@Scheduled 方法中调用挂起的函数?我希望它等到挂起的功能完成。
/// This function starts every 00:10 UTC
@Scheduled(cron = "0 10 0 * * *", zone = "UTC")
fun myScheduler() {
// ???
}
suspend fun mySuspendedFunction() {
// business logic
}
【问题讨论】:
标签: spring spring-boot kotlin spring-webflux kotlin-coroutines