From 37f303aa95b9f6e09db8db216dbe39834ef4ca98 Mon Sep 17 00:00:00 2001 From: songhuangfeng123 <shf18767906695@163.com> Date: 星期五, 02 九月 2022 13:58:58 +0800 Subject: [PATCH] fix --- goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/schedule/KeepAliveRobot.java | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/schedule/KeepAliveRobot.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/schedule/KeepAliveRobot.java new file mode 100644 index 0000000..7e457f0 --- /dev/null +++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/schedule/KeepAliveRobot.java @@ -0,0 +1,27 @@ +package com.gkhy.safePlatform.targetDuty.schedule; + +import com.gkhy.safePlatform.targetDuty.service.TargetTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + + +@Component("goalKeepAlive") +@EnableScheduling +@ConditionalOnProperty(prefix = "threadPool.scheduling", name = "enabled", havingValue = "true") +public class KeepAliveRobot { + + @Autowired + private TargetTypeService targetTypeService; + + // 30m + @Scheduled(cron = "0 0/30 * * * ?") + public void keepAlive(){ + // + targetTypeService.getById(-1L); + + } + +} -- Gitblit v1.9.2