title: Spring Scheduling - Cron expression for everyday at midnight not working?
body: <p>I am trying to schedule a task in Spring which is to be run everyday at midnight. I followed the <a href="https://spring.io/guides/gs/scheduling-tasks/" rel="noreferrer">official guide</a> from Spring and made the scheduler class as below:</p>
  <pre><code>@Component
  public class OverduePaymentScheduler {    
      @Scheduled(cron = &quot;0 0 0 * * *&quot;)
      public void trackOverduePayments() {
          System.out.println(&quot;Scheduled task running&quot;);
      }
  }
  </code></pre>
  <p>However the task does not run when the clock hits 12am. I got the cron expression from the documentation for quartz scheduler at this <a href="http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger" rel="noreferrer">link</a>.</p>
  <p>The scheduler is executed fine if I change the cron expression to &quot;*/10 * * * * *&quot; which runs every ten seconds.</p>
  <p>So what am I doing wrong?</p>