固定延迟

如果我们想要在执行之前定期执行一些代码,那么我们应该使用固定延迟(以毫秒为单位):

@Component
public class MyScheduler{    
    
    @Scheduled(fixedDelay=5000)
    public void doSomething() {
        // this will execute periodically, after the one before finishes
    }
}