package com.nanyan.securitylink.schedule; import com.nanyan.securitylink.config.AppConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.support.CronTrigger; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; @Service @EnableScheduling public class ScheduledTasksService { private final TaskScheduler taskScheduler; @Autowired RefreshConfigSync refreshConfigSync; public ScheduledTasksService(TaskScheduler taskScheduler) { this.taskScheduler = taskScheduler; } // @PostConstruct public void scheduleTask() { //定时刷新配置 taskScheduler.scheduleWithFixedDelay(() -> { refreshConfigSync.autoRefreshConfig(); }, 60000); } }