首先引入定时器所需依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
然后在启动类添加注解@EnableScheduling
最后使用定时器
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @Auther: AmbroseLee
* @Date: 2018/9/6 15:48
* @Description: 定时器1
*/
@Component
public class SchedulerTask {
private int count=0;
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
@Scheduled(cron="*/6 * * * * ?")
private void process(){
Sys