package com.gkhy.safePlatform.account.schedule;
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.stereotype.Component;
|
|
import java.util.Date;
|
|
@Component
|
@EnableScheduling
|
@ConditionalOnProperty(prefix = "threadPool.scheduling", name = "enabled", havingValue = "true")
|
public class TestScheduleJob {
|
|
private int i = 0;
|
|
// @Scheduled(cron = "0/5 * * * * ?") //每隔5s执行一次
|
public void showTime(){
|
System.out.println(new Date().toString());
|
i++;
|
if(i == 3){
|
int a = this.i / 0;
|
}
|
}
|
}
|