title: Difference between Quartz Job and Scheduling Tasks with Spring?
body: <p>I am new to Spring-boot(version 1.3.6) and Quartz and I am wondering what is the difference between making a task with <a href="https://spring.io/guides/gs/scheduling-tasks/" rel="noreferrer">Spring-scheduler</a>:</p>
  
  <pre><code>    @Scheduled(fixedRate = 40000)
      public void reportCurrentTime() {
          System.out.println("Hello World");
      }
  </code></pre>
  
  <p>And the <a href="http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-03.html" rel="noreferrer">Quartz way</a>:</p>
  
  <pre><code>0. Create sheduler.
  1. Job which implements Job interface.
  2. Create JobDetail which is instance of the job using the builder  org.quartz.JobBuilder.newJob(MyJob.class)
  3. Create a Triger
  4. Finally set the job and the trigger to the scheduler
  </code></pre>
  
  <p>In code:</p>
  
  <pre><code>  public class HelloJob implements Job {
  
      public HelloJob() {
      }
  
      public void execute(JobExecutionContext context)
        throws JobExecutionException
      {
        System.err.println("Hello!");
      }
    }
  </code></pre>
  
  <p>and the sheduler:</p>
  
  <pre><code>SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();
  
    Scheduler sched = schedFact.getScheduler();
  
    sched.start();
  
    // define the job and tie it to our HelloJob class
    JobDetail job = newJob(HelloJob.class)
        .withIdentity("myJob", "group1")
        .build();
  
    // Trigger the job to run now, and then every 40 seconds
    Trigger trigger = newTrigger()
        .withIdentity("myTrigger", "group1")
        .startNow()
        .withSchedule(simpleSchedule()
            .withIntervalInSeconds(40)
            .repeatForever())
        .build();
  
    // Tell quartz to schedule the job using our trigger
    sched.scheduleJob(job, trigger);
  </code></pre>
  
  <p>Does Quartz provide more flexible way to define Jobs, Triggers and Schedulers or Spring Scheduler has something else which is better?</p>