import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* @Description: 定时任务
* @ClassName: TimeRunUtil
* @Author: S
* @Date: 2020/4/1 8:56
* @Company:
*/
//springboot定时任务中的异步任务可以使用@Asyns注解进行开启异步任务
@Component
@Configuration //1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling // 2.开启定时任务
@Transactional //执行事务
public class TimeRunUtil {
/**
* @Description: 每日凌晨1点零一分执行一次
* @Author: S
* @Since: 2020/4/1 9:02
* @Param
* @Company:
*/
@Scheduled(cron="0 1 1 * * ?")
public void sufferingStopProduction() {
}
/**
* @Description: 每日凌晨一点零一分判断
* @Author: S
* @Since: 2020/5/6 15:32
* @Param * @Param null
*/
@Scheduled(cron="0 1 1 * * ?")
public void updateDischargePermitStatus() {
}
}
开启定时任务
最新推荐文章于 2023-08-17 23:47:33 发布