title: How to run method on startup and schedule according the the cron expression and avoid parallel execution
body: <p>I want to run job every day at 14:00. Also  I want to run that job after application startup. This job is long enough(lets say 10 min) and I am afraid what happens if startup happens at 13:58. I want to forbid concurrent task execution.</p>
  
  <p>Will the below work?</p>
  
  <pre><code>@Scheduled(cron = "0 14 * * *")
  public void scheduleTaskUsingCronExpression() {
    jobMehod();        
  }
  public synchronized void jobMehod(){
    // code wihout creation new threads
  }
  @EventListener(ContextRefreshedEvent.class)
  public void onStartup(){
      jobMehod();
  }
  </code></pre>