Posts

Showing posts with the label cron

Schedule Tasks in Spring 3 : @Scheduled

Spring provides excellent support for scheduling jobs based on different implementations. (eg: cron). This scheduling is possible with use of @Scheduled annotation. According to spring documentation: Spring 3.0 also adds annotation support for both task scheduling and asynchronous method execution. The @Scheduled annotation can be added to a method along with trigger metadata. In this post, I will show the means to use this feature in 4 different ways. @Scheduled annotation This annotation is used for task scheduling. The trigger information needs to be provided along with this annotation. You can use the properties fixedDelay/fixedRate/cron to provide the triggering information. fixedRate  makes Spring run the task on periodic intervals even if the last invocation may be still running. fixedDelay  specifically controls the next execution time when the last execution finishes. cron  is a feature originating from Unix cron utility and has various options b...