Quick revision
The short answer
A @Scheduled method that silently never runs usually means Spring never registered it or never got around to it. The common causes are a missing @EnableScheduling, a class that is not a Spring bean (created with new, outside component scanning, or never created because of lazy initialization), a cron expression that never matches or was disabled with "-", the single default scheduler thread being blocked by another task, or the application ending before the first run.
What to remember
In this answer, we followed the chain a @Scheduled method needs: scheduling enabled with @EnableScheduling, a class that Spring actually creates as a bean, a schedule that produces a next time and is not disabled with "-", a free scheduler thread, and an application that is still running when the time comes. Each link can break silently, and the Actuator scheduledtasks endpoint, CronExpression.next() and a thread dump tell us quickly which one did.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
A @Scheduled method that silently never runs usually means Spring never registered it or never got around to it. The common causes are a missing @EnableScheduling, a class that is not a Spring bean (created with new, outside component scanning, or never created because of lazy initialization), a cron expression that never matches or was disabled with "-", the single default scheduler thread being blocked by another task, or the application ending before the first run.
Why this question is asked
A scheduled job that fails loudly is easy: the stack trace tells us what is wrong. A job that simply never runs, with clean logs, is harder, because there is nothing to search for. Interviewers like this question because a good answer is a structured checklist that follows the path from annotation to execution, and because the same reasoning applies to other annotations Spring processes at startup. In this answer, we will recap what has to happen for a @Scheduled method to run, then walk through each place where that chain can break, with a quick way to confirm each cause.
1What Has to Happen for a @Scheduled Method to Run
@Scheduled is just metadata. Nothing reads it unless scheduling is enabled. @EnableScheduling registers a bean post-processor, a component that inspects every bean Spring creates. When it finds a method with @Scheduled, it registers a task with the TaskScheduler, which then calls the method at the right times on one of its threads.
So four things must all be true: scheduling is enabled, the object is a bean that Spring actually creates, the schedule produces a next execution time, and a scheduler thread is free when that time comes. The checklist below follows that chain in order, which is also the order in which we should check.
- Is @EnableScheduling present?Yesnext checkNoadd it to a @Configuration class
- Is the class a bean Spring creates?Yesnext checkNofix scanning, new, lazy init or conditions
- Does the schedule have a next time?Yesnext checkNofix the cron, check for "-" or an impossible date
- Is a scheduler thread free?Yesnext checkNofind the blocking task, add threads
- Is the application still running at that time?Yeslook at the method itselfNokeep the context alive
5 steps in order. Play them, or step through them one at a time.
2Cause 1: Scheduling Is Not Enabled
Spring Boot auto-configures a TaskScheduler, but it does not switch on @Scheduled processing by itself. Without @EnableScheduling on some configuration class, the annotations are simply ignored, and nothing is logged about it.
A common way to lose it is moving it to a configuration class that is behind a profile or a condition, or into a test configuration only. The quickest confirmation is the Actuator endpoint /actuator/scheduledtasks, which lists every registered task; if our method is missing there, the chain broke before the scheduler.
3Cause 2: The Object Is Not a Spring Bean
The post-processor only sees beans that Spring creates. If we create the class ourselves with new ReminderJob(), it is an ordinary object and its annotations mean nothing. The same is true when the class sits in a package outside component scanning, below a different root than the @SpringBootApplication class, or when it is excluded by a @Profile, a @ConditionalOnProperty that does not match, or a scan filter.
A quieter variant is lazy initialization. With spring.main.lazy-initialization=true, Spring only creates a bean when something first asks for it. A scheduled job class is usually not injected anywhere, so nobody ever asks for it, it is never created, and its method is never registered. Marking that bean @Lazy(false) fixes it.
4Cause 3: The Schedule Never Produces a Time
A cron expression can be valid and still never match. "0 0 9 30 2 *" asks for 09:00 on 30 February, which never comes, so the scheduler finds no next time and the task is never run, with no error. Wrong field order is a similar trap: Spring cron starts with seconds, so a five-field Unix expression is rejected at startup, but a six-field expression copied with the fields shifted can be accepted and mean something quite different, such as once a year instead of once a day.
Spring also has a deliberate off switch: a cron value of "-" disables the task. That is useful in configuration, cron = "${reminders.cron}", but it means one environment's properties file can turn the job off without anyone noticing. And with fixedRate or fixedDelay, a very large initialDelay looks exactly like a task that never runs.
Calling CronExpression.parse(...).next(...) in a test or a shell is the fastest way to see what an expression really means.
5Cause 4: The Only Scheduler Thread Is Busy
Spring Boot's default scheduler has a single thread, shared by every scheduled task in the application. If another task is stuck, for example waiting on a remote call that has no timeout, our task stays in the queue and never starts, and nothing is logged because nothing has failed.
A thread dump settles this in seconds. If the thread named scheduling-1 is in the middle of another job's method, sitting in a socket read, that job is the culprit. The fix is to give that call a timeout and to raise spring.task.scheduling.pool.size so slow jobs cannot block the others.
6Cause 5: The Application Ends Before the First Run, and Other Checks
A scheduled task only runs while the application context is alive. A command-line application that finishes its main work and exits, a test whose context closes after the test, or a container that is restarted by a failing health check every few minutes may never reach the first run time of a daily job. With virtual threads, scheduler threads are daemon threads that do not keep the JVM alive, which is why Spring Boot has the spring.main.keep-alive property; check your version.
Two more things are worth a look. A method with parameters is rejected at startup with an IllegalStateException, so if the logs truly show no errors, that is not it, but it is worth confirming the startup log was really read. And if the method runs but the work seems missing, set logging.level.org.springframework.scheduling to DEBUG and add a log line at the top of the method, because an exception inside a scheduled method is logged by the scheduler's error handler and the task simply runs again next time.
7Follow-up questions
How can I see all registered scheduled tasks?
Spring Boot Actuator's scheduledtasks endpoint lists every cron, fixed-delay and fixed-rate task with its target method and schedule. If the endpoint is exposed, it is the quickest proof that registration happened, and it separates the 'never registered' causes from the 'registered but never ran' ones.
Does @Scheduled work on a method of a @Configuration class?
Yes. Any bean works, including configuration classes, as long as scheduling is enabled. What does not work is an object Spring did not create, or a bean that is never created because of lazy initialization.
What happens if the scheduled method throws an exception?
With the default setup, the scheduler's error handler logs the exception and, for a repeating task, the next run is scheduled as normal. So an exception does not stop the schedule, and it shows up in the logs, which is why it does not match the 'no errors at all' symptom.
8Conclusion
In this answer, we followed the chain a @Scheduled method needs: scheduling enabled with @EnableScheduling, a class that Spring actually creates as a bean, a schedule that produces a next time and is not disabled with "-", a free scheduler thread, and an application that is still running when the time comes. Each link can break silently, and the Actuator scheduledtasks endpoint, CronExpression.next() and a thread dump tell us quickly which one did.
Open with
I would go through the chain from annotation to execution. First, is @EnableScheduling there? Boot does not enable scheduling on its own, and without it the annotation is just ignored.
Then, if they want more
Second, is the class really a Spring bean? If it was created with new, sits outside component scanning, is excluded by a profile or condition, or the app uses lazy initialization and nothing injects the bean, the post-processor never sees it. The Actuator scheduledtasks endpoint tells me quickly whether the task was registered. Third, does the schedule ever fire?
A cron like 30 February never matches, fields shifted by one can mean once a year, a cron of dash from configuration disables the task, and a huge initialDelay looks the same. I check with CronExpression.parse and next. Fourth, is the scheduler thread free?
Boot's default scheduler has one thread, so another task stuck on a call without a timeout blocks everything; a thread dump of scheduling-1 shows it. Fifth, is the application alive at that time, or does it exit or restart first? A method with parameters would fail at startup, so with clean logs I would look at the first four.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Batch reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "A @Scheduled method in a Spring Boot service never runs, and there are no errors in the...": https://scrivio-interview-library.netlify.app/spring-boot/scheduling/9596c3d53f/