0%

springBoot启动执行任务

文章字数:35,阅读全文大约需要1分钟

启动任务代码

1
2
3
4
5
6
7
8
9
10
11
12
13
@Component
@Order(value = 31)
@Slf4j
public class dataProcessor implements CommandLineRunner{
@Override
public void run(String... strings) throws Exception {
while (true) {
TimeUnit.SECONDS.sleep(10);
//原本这个方法上加的定时,现在改为循环
dataTiming();
}
}
}