ScheduleTest.java 565 字节
Newer Older
Q
qinyingjie 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
package com.kwan.springbootkwan.schedule;


import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


/**
 * schedule测试  10s执行一次  记得在启动类或者Configuration类上添加了@EnableScheduling注解。
 *
 * @author : qinyingjie
 * @version : 2.2.0
 * @date : 2022/12/9 13:58
 */
@Component
@Slf4j
public class ScheduleTest {

    @Scheduled(cron = "0/10 * * * * ?")
    public void execute() {
        log.info("Scheduled task is running ... ...");
    }
}