springboot中使用ThreadPoolTaskScheduler定时执行一次任务
一.直接上代码,调用run方法,传入定时任务执行时间,到时间自动执行
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component;
原创
2021-05-13 15:48:19 ·
1876 阅读 ·
0 评论