xxxxxxxxxx
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class MyScheduledTask {
@Scheduled(cron = "0 0/5 * 1/1 * ?") // runs every 5 minutes
public void runTask() {
// Code to be executed every 5 minutes
System.out.println("Task executed!");
}
}