← All tutorials

GoCareerGo Tutorials

Spring Boot Tutorial

Auto-configuration, REST APIs, JPA, AOP, caching, microservices and Spring Cloud.

Task Scheduling (@Scheduled)

Runs a method automatically on a fixed schedule — no external cron job needed.

@EnableScheduling
@Component
public class ReportJob {
    @Scheduled(fixedRate = 60000)      // every 60 seconds
    public void runEveryMinute() { ... }

    @Scheduled(cron = "0 0 * * * *")   // every hour, on the hour
    public void runHourly() { ... }
}