title: @Autowired doesn't work if applied to a bean shared between two threads
body: <p>I have some troubles with a very basic scenario: I have a java web app (spring 3) and I want to store some object to a stack. Then I want to manage the objects in the stack with a scheduler and so I implemented a quartz job. Plain and simple. I inject the stack in the first service class and in the job class with @Autowired annotation. For the service class the table is succesfully injected but for the job class the table is null.
  here's the code:</p>
  
  <p>the class to share</p>
  
  <pre><code>package it.unifi.det.telemat.vr.data;
  @Component
  public class IndexedNodesStack extends HashMap&lt;IndexedObject, Boolean&gt;{
  
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
  
      @Override
      public synchronized int size() {
          // TODO Auto-generated method stub
          return super.size();
      }
  
      //all the HashMap methods are implemented in a synchronized wrapper method
  
  }
  </code></pre>
  
  <p>the first class (@Autowired is successful)</p>
  
  <pre><code>package it.unifi.det.telemat.vr.service;
  @Service
  public class InnerNodeManager extends ConcreteNodeManager{
  
      @Autowired
      private IndexedNodesStack indexedNodesStack; //&lt;--- it is actually autowired!
  
  
      private void manageIndexedNodes(Boolean isPut, String lri, String features)
      {
          IndexedObject indexedObject = new IndexedObject();
          indexedObject.setId(lri);
          if(features != null &amp;&amp; isPut)
              indexedObject.generateFeatures(features);
  
          indexedNodesStack.put(indexedObject, isPut);
      }
  
  }
  </code></pre>
  
  <p>the job class (@Autowired fails)</p>
  
  <pre><code>package it.unifi.det.telemat.vr.service.scheduler;
  @Component
  public class QuartzJSearchJob extends QuartzJobBean{
  
      @Autowired
      private IndexedNodesStack indexedNodesStack; //&lt;--- this variable is null :-(
  
      @Override
      protected void executeInternal(JobExecutionContext context) throws JobExecutionException
      {
          //do work       
      }
  }
  </code></pre>
  
  <p><strong>EDIT:</strong> here's the servlet.xml</p>
  
  <pre><code>&lt;context:component-scan base-package="it.unifi.det.telemat.vr" /&gt;
  
  &lt;bean name="searchJob"
  class="org.springframework.scheduling.quartz.JobDetailBean"&gt;
      &lt;property name="jobClass" value="it.unifi.det.telemat.vr.service.scheduler.QuartzJSearchJob" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="searchJobTrigger"
  class="org.springframework.scheduling.quartz.CronTriggerBean"&gt;
      &lt;property name="jobDetail" ref="searchJob" /&gt;
      &lt;property name="cronExpression" value="0/50 * * * * ?" /&gt;
  &lt;/bean&gt;
  
  &lt;bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt;
      &lt;property name="triggers"&gt;
      &lt;list&gt;
          &lt;ref bean="searchJobTrigger" /&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>maybe I lack some knowledge about the resource sharing between threads since it is my first attempt in this field.
  What am I missing?</p>