1.定时器
1.1在pom中引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
1.1 创建一个任务类
package com.xyf.springbootauto.MyTask;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class MyTask {
@Scheduled(cron = "0/10 * * * * ?")
public void task(){
System.out.println("``````````````");
}
}
1.2.在启动类上加入定时器的注解
<