title: spring autowired vs resource
body: <p>So my question why did @javax.annotation.Resource worked but @AutoWired did not. For a test on a Restful controller, I was trying to inject MappingJackson2HttpMessageConverter with @Autowired, on start up the container failed to find a qualifying bean even though that class was on the path. Now, to solve this I went into a context xml file and added the bean:</p>
  
  <pre><code>&lt;bean id="jsonConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/&gt;
  </code></pre>
  
  <p>Then in the test class had member variable: </p>
  
  <pre><code>@javax.annotation.Resource(name="jsonConverter")
  private  MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter;
  </code></pre>
  
  <p>Then spring finds the bean. Does Autowire only work for beans that were identified as beans by package scan?</p>
  
  <p>Thanks ahead of time. </p>