spring Task Execution and Scheduling Fixed Rate


Example

If we want something to be executed periodically, this code will be triggered once per the value in milliseconds we specify:

@Component
public class MyScheduler{    
    
    @Scheduled(fixedRate=5000)
    public void doSomething() {
        // this will execute periodically
    }
}