title: @Autowired is not working in quartz job class
body: <p>I'm sending post request to run() method class name is ScheduleGame. This class the creates the Quartz RAM based job and triggers.  </p>
  
  <pre><code>@Component
  public class ScheduleGame {
      Logger log = LoggerFactory.getLogger(ScheduleGame.class);
  
      public String run(String jobName, String jobGroup, Class jobClass, String jobTrigger, String cronExp) throws Exception {
          try {
              isJobExist(jobGroup, jobName);
  
  
              log.info("------- Initializing -------------------");
              // First we must get a reference to a scheduler
              SchedulerFactory sf = new StdSchedulerFactory();
              Scheduler sched = sf.getScheduler();
              log.info("------- Initialization Complete --------");
  
              log.info("------- Scheduling Jobs ----------------");
              // job1 will only fire once at date/time "ts"
              JobDetail job = newJob(jobClass).withIdentity(jobName, jobGroup).build();
              CronTrigger trigger = newTrigger().withIdentity(jobTrigger, jobGroup).withSchedule(
                      cronSchedule(cronExp).withMisfireHandlingInstructionFireAndProceed()).build();
  
  
              // schedule it to run!
              Date ft = sched.scheduleJob(job, trigger);
              log.info(job.getKey() + " will run at: " + ft + " and repeat: " + trigger.getNextFireTime() + " times, every "
                      + trigger.getExpressionSummary() + " seconds");
              sched.start();
              log.info(sched.getSchedulerName());
              return "Game Created and Scheduled, it will run at: " + ft;
  
          } catch (CustomException e) {
              throw new Exception(e.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>my job class is</p>
  
  <pre><code>@Component
  public class Job implements InterruptableJob {
  
      private static Logger _log = LoggerFactory.getLogger(Job.class);
      private JobKey _jobKey = null;
      @Autowired
      private Results results;
  
      /*public void setResults(Results results) {
          this.results = results;
      }*/
  
      /**
       * Empty constructor for job initialization
       */
      public Job() {
      }
  
      /**
       * &lt;p&gt;
       * Called by the &lt;code&gt;{@link org.quartz.Scheduler}&lt;/code&gt; when a
       * &lt;code&gt;{@link org.quartz.Trigger}&lt;/code&gt; fires that is associated with
       * the &lt;code&gt;Job&lt;/code&gt;.
       * &lt;/p&gt;
       *
       * @throws JobExecutionException if there is an exception while executing the job.
       */
      public void execute(JobExecutionContext context)
              throws JobExecutionException {
          SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
          // This job simply prints out its job name and the
          // date and time that it is running
          _jobKey = context.getJobDetail().getKey();
          _log.info("Job Name: "+ _jobKey.getName() +" Job Group: "+ _jobKey.getGroup()+" SimpleJob says: " + _jobKey + " executing at " + new Date());
  
          results.lotteryResults(_jobKey.getName(),_jobKey.getGroup());
  
      }
  
      @Override
      public void interrupt() throws UnableToInterruptJobException {
          _log.info("---" + _jobKey + "  -- INTERRUPTING --");
      }
  }
  </code></pre>
  
  <p>Exception is:</p>
  
  <pre><code>java.lang.NullPointerException: null
      at agaming.casino.lottery.handler.Job.execute(Job.java:54)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
  .19:24:00.001 [DefaultQuartzScheduler_Worker-10] ERROR org.quartz.core.ErrorLogger - Job (SampleJob.Sample Job threw an exception. 
  org.quartz.SchedulerException: Job threw an unhandled exception.
      at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
  Caused by: java.lang.NullPointerException: null
      at agaming.casino.lottery.handler.Job.execute(Job.java:54)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
      ... 1 common frames omitted
  </code></pre>
  
  <p>When trigger fire on scheduled time the job is running fine if there is no @Autowired followed by my service class. But I've t @Autowired my services to do other business functions on job fires. </p>
  
  <p>How to @Autowired my services in Quartz job class</p>
  
  <p>I'm using Spring Boot</p>