Recall & Review
beginner
What is the purpose of the @Scheduled annotation in Spring Boot?
The @Scheduled annotation is used to mark a method to be executed automatically at fixed intervals or specific times, enabling scheduled tasks in a Spring Boot application.
Click to reveal answer
beginner
How do you enable scheduling support in a Spring Boot application?
You enable scheduling by adding the @EnableScheduling annotation to a configuration class or the main application class.Click to reveal answer
intermediate
What are the common parameters of the @Scheduled annotation?
Common parameters include fixedRate (runs method at fixed intervals), fixedDelay (runs method after a fixed delay from last completion), and cron (runs method based on a cron expression).
Click to reveal answer
intermediate
Explain the difference between fixedRate and fixedDelay in @Scheduled.
fixedRate runs the method at regular intervals regardless of how long the method takes, while fixedDelay waits until the previous execution finishes and then waits the specified delay before running again.
Click to reveal answer
advanced
What is a cron expression in the context of @Scheduled?
A cron expression is a string that defines a schedule using fields for seconds, minutes, hours, day of month, month, day of week, and optionally year, allowing precise control over when a task runs.
Click to reveal answer
Which annotation must be added to enable scheduling in Spring Boot?
✗ Incorrect
You must add @EnableScheduling to enable scheduling support. @Scheduled marks the methods to run on schedule.
What does fixedRate in @Scheduled do?
✗ Incorrect
fixedRate runs the method at regular intervals, ignoring how long the method takes.
Which parameter of @Scheduled allows scheduling with a cron expression?
✗ Incorrect
The cron parameter accepts a cron expression to schedule tasks precisely.
If you want a method to run 5 seconds after the last execution finishes, which @Scheduled parameter do you use?
✗ Incorrect
fixedDelay waits 5 seconds after the last execution finishes before running again.
Where do you place the @Scheduled annotation?
✗ Incorrect
@Scheduled is placed on the method that should run on a schedule.
Describe how to set up a scheduled task in Spring Boot using @Scheduled.
Think about enabling scheduling and marking methods.
You got /4 concepts.
Explain the difference between fixedRate and fixedDelay in scheduling tasks.
Consider timing relative to method execution.
You got /2 concepts.