‏إظهار الرسائل ذات التسميات Schedules. إظهار كافة الرسائل
‏إظهار الرسائل ذات التسميات Schedules. إظهار كافة الرسائل

الأحد، 16 أغسطس 2020

Spring Boot Scheduling Tasks With @Scheduled Annotation

1. Introduction

In this tutorial, We'll learn how to run scheduled jobs in Spring Boot. There are some scenarios, you need to perform some tasks periodically at a fixed interval of time. Spring boot provides mainly with @Scheduled fixedRate and fixedDelay attributes.

In fact, Spring Boot bundled with two annotations those support scheduling at a given time.

@EnableScheduling and @Scheduled annotations do the job in spring boot. 

First, @EnableScheduling should be applied to the SpringBootApplication.
Next, @Scheduled must be applied on any method but that method should not take any arguments and should not return any value hence void should be return type.


Spring Boot Scheduling Tasks Examples - @Scheduled fixedRate Vs fixedDelay