package com.backendsys.config.ScheduledTasks;

import jakarta.annotation.PostConstruct;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.CompletableFuture;

/**
 * 定时任务
 */
@Configuration
@EnableAsync
public class ScheduledTasksConfig {

    /**
     * [方法] 控制台输出
     */
    private void scheduledConsole(String message) {
        System.out.println("[Scheduled][" + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date()) + "]: " + message);
    }

//    /**
//     * 执行定时任务
//     */
//    @Async
//    @Scheduled(fixedRate = 5000)
//    public void executeTask() {
//        // 执行定时任务
//        scheduledConsole("executeTask..");
//    }



}
