title: How to correctly schedule this 5 minutes Spring Batch Job? Why is it starting immediatly instead of waiting for the set time?
body: <p>I am working on a Spring Batch application and I am finding some difficulties trying to correctly schedule a job.</p>
  <p>I have this class where my job was scheduled:</p>
  <pre><code>/**
   * This bean schedules and runs our Spring Batch job.
   */
  @Component
  @Profile(&quot;!test&quot;)
  public class SpringBatchExampleJobLauncher {
  
      private static final Logger LOGGER = LoggerFactory.getLogger(SpringBatchExampleJobLauncher.class);
  
      @Autowired
      @Qualifier(&quot;launcher&quot;)
      private JobLauncher jobLauncher;
      
      @Autowired
      @Qualifier(&quot;updateNotaryDistrictsJob&quot;)
      private Job updateNotaryDistrictsJob;
  
      @Autowired
      @Qualifier(&quot;updateNotaryListInfoJob&quot;)
      private Job updateNotaryListInfoJob;
      
      @Scheduled(cron = &quot;0 */5 * * * *&quot;)
      public void runUpdateNotaryDistrictsJob() {
          LOGGER.info(&quot;SCHEDULED run of updateNotaryDistrictsJob STARTED&quot;);
          Map&lt;String, JobParameter&gt; confMap = new HashMap&lt;&gt;();
          confMap.put(&quot;time&quot;, new JobParameter(System.currentTimeMillis()));
          JobParameters jobParameters = new JobParameters(confMap);
          try {
              jobLauncher.run(updateNotaryDistrictsJob, jobParameters);
          }catch (Exception ex){
              LOGGER.error(ex.getMessage());
          }
  
      }
      
  }
  </code></pre>
  <p>As you can see on my <strong>runUpdateNotaryDistrictsJob()</strong> method I set this Spring CRON expression:</p>
  <pre><code>@Scheduled(cron = &quot;0 */5 * * * *&quot;)
  </code></pre>
  <p>in order to start my <strong>updateNotaryDistrictsJob</strong> every 5 minutes.</p>
  <p>The problem is that when I run my application in debug mode I can see that the job is immediately performed (it stop on the first breakpoint). It seems that it is not waiting the 5 minutes set by the cron expression.</p>
  <p>What is wrong? How can I try to solve this issue?</p>