import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.io.IOException;
@Configuration
@EnableScheduling
public class MachineTask {
@Resource
private BdcLockMapper bdcLockMapper;
/**
* 工作日时间,每5s执行一次
*/
@Scheduled(cron = "0/10 * 9-20 * * ?")
private void windowsFlush() throws IOException {
System.err.println("定时器执行了");
}
}
SpringBoot简单实现定时任务
最新推荐文章于 2024-07-10 15:31:21 发布