title: Spring-Boot Quartz Job is not running
body: <p>I just started to create Quartz Scheduled Jobs in a dynamic way. So there is a QuartzConfig class where I create a <code>SchedulerFactoryBean</code>, <code>JobDetailFactoryBean</code> and <code>CronTriggerFactoryBean</code>. Wherein the Job and CronTrigger beans are prototype ones.</p>
  
  <pre><code>@Configuration
  public class QuartzConfig {
  
      @Autowired
      ApplicationContext context;;
  
      @Bean
      public SchedulerFactoryBean quartzScheduler(){
          SchedulerFactoryBean quartzScheduler = new SchedulerFactoryBean();
          quartzScheduler.setOverwriteExistingJobs(true);
          quartzScheduler.setSchedulerName("job-scheduler");
          AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory();
          jobFactory.setApplicationContext(context);
          quartzScheduler.setJobFactory(jobFactory);
          return quartzScheduler;
      }
  
      @Bean
      @Scope(value = "prototype")
      public JobDetailFactoryBean getJobBean(){
          JobDetailFactoryBean bean = new JobDetailFactoryBean();
          bean.setJobClass(DailyJob.class);
          bean.setGroup("daily-group");
          bean.setName("daily-name");
          bean.setBeanName("daily-name");
          bean.getJobDataMap().put("daily", "daily");
          return bean;
      }
  
      @Bean
      @Scope(value = "prototype")
  //    @Lazy(value = true)
      public CronTriggerFactoryBean getCronTriggerBean(String cron){
          CronTriggerFactoryBean bean = new CronTriggerFactoryBean();
          bean.setCronExpression(cron);
          bean.setJobDetail(getJobBean().getObject());
          bean.setGroup("daily-group");
          return bean;
      }
  }
  </code></pre>
  
  <p>In my Controller class I want to create the jobs by request. I autowire <code>SchedulerFactoryBean</code> to set the quartz trigger to the bean. </p>
  
  <pre><code>@Controller
  public class JobController {
  
      @Autowired
      SchedulerFactoryBean quartzScheduler;
  
      @Autowired
      ApplicationContext context;;
  
      @ResponseBody
      @RequestMapping("/job/create/daily")
      public String dailyJob(){
          CronTriggerImpl cron = (CronTriggerImpl) context.getBean("getCronTriggerBean","30 * * ? * MON-FRI");
          Trigger[] triggers = { cron };
          quartzScheduler.setTriggers(triggers);
          return "dailyJob";
      }
  }
  </code></pre>
  
  <p>Everything works without creating an error and the <code>Job</code> and the <code>Trigger</code> are set to the <code>quartzScheduler</code> (see it in debug mode). But the Job is never running. What do I miss? </p>
  
  <p>And dont to forget, there is a class which implements <code>Job</code>:</p>
  
  <pre><code>@Component
  public class DailyJob implements Job{
  
      @Override
      public void execute(JobExecutionContext context) throws JobExecutionException {
          System.out.println("Daily Job runs!");
      }
  }
  </code></pre>