Springboot定时任务
@SpringBootApplication
@EnableScheduling
public class Application{
public static void main(String[] args) {
SpringApplication.run(Application.class,args);
}
}
@Component
public class SaticScheduleTask {
//添加定时任务
//@Scheduled(cron = "0/5 * * * * ?")
//或直接指定时间间隔,例如:5秒
//@Scheduled(fixedRate=5000)
@Scheduled(fixedRate=5000)
public static void configureTasks() {
String filePath = "C:/Users/hongda/Desktop/ik.conf"; // 文件路径
TestIO obj = new TestIO();
obj.write(filePath, obj.read(filePath)); // 读取修改文件
}
}