springboot定时任务
package com.example.demo.until;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @program:
* @description: 定时任务
* @author:
* @create:
**/
@Component
@EnableScheduling
public class Timer {
// @Resource
// TimingService timingService;
/**
* 每隔1秒执行一次
*/
@Scheduled(fixedRate = 1000)
public void initTime() {
// timingService.方法
}
}