title: Spring @Autowired not working on new thread
body: <p>When I run TaskJob I am getting null pointer exception because Spring doesn't autowiring serviceJob service. Is new thread causing this problem because Spring autowired mysqlService without any problem?</p>
  
  <pre><code>public class TaskJob implements Runnable {
      @Autowired
      private ServiceJob serviceJob;
  
      String name;
      String source;
  
      public TaskJob(String name, String source) {
          this.name = name;
          this.source = source;
      }
  
      public void run() {
          serviceJob.run();
      }
  }
  
  @Service
  public class ServiceJob extends BaseJob{
  
      @Autowired
      private MysqlService mysqlService;
  
      public void run(){
      ....
      }
  }
  
  @Service
  public class MysqlService {
  ...
  }
  </code></pre>
  
  <p>My applicationContext.xml;</p>
  
  <pre><code>&lt;context:component-scan base-package="cm.*" /&gt; 
  </code></pre>
  
  <p>And my classes are;</p>
  
  <pre><code>cm.tasks.jobs.TaskJob
  cm.jobs.ServiceJob
  cm.services.MysqlService;
  </code></pre>
  
  <p><strong>EDIT:</strong> TaskJob instanciated with;</p>
  
  <pre><code>TaskJob taskJob = new TaskJob(name, source);
  Thread taskThread = new Thread(taskJob);
  taskThread.start();
  </code></pre>