首页 > 解决方案 > 我如何在 Springboot 中为 Thread shedule 命名

问题描述

我有一个有很多时间表的 Java 类,但我想为时间表设置一个名称,但我不知道。当我使用 Java Time 时,这是可能的,但是在 Spring 中怎么做呢?我需要设置一个名称,因为我的系统有很多 Java 线程。

- 与春天?

@Scheduled(cron = "00 00 06 * * ?", zone = TIME_ZONE)
@Scheduled(cron = "00 00 11 * * ?", zone = TIME_ZONE)
@Scheduled(cron = "00 00 16 * * ?", zone = TIME_ZONE)
@Scheduled(cron = "00 00 19 * * ?", zone = TIME_ZONE)
@Scheduled(cron = "00 00 22 * * ?", zone = TIME_ZONE)
public void updateCacheEmployee() {

    funcionarioRepository.listAllEmployeeByRFID(Utility.FORCE_UPDATE);
    funcionarioRepository.listAllEmployeeByFingerPrint(Utility.FORCE_UPDATE);
    Utility.print(c, ".....Update the cache: ", Utility.TYPE_ALERT);
}

标签: javaspring-bootscheduling

解决方案


推荐阅读