title: @Autowired in @Service?
body: <p>I'm having trouble getting @Autowired to work in a class annotated by @Service, the autowired variable always is null. Let me explain:</p>
  
  <pre><code>@Service
  public class Searcher extends Thread implements ISearcher {
  @Autowired
  protected ISessionProvider sessionProvider; &lt;-- always null
  ...
  public Searcher() {
  sessionProvider.doSomeStuff();
  }
  </code></pre>
  
  <p>sessionProvider here is always null.</p>
  
  <p>The strange thing is that the same autowire in a @Controller does work:</p>
  
  <pre><code>@Controller
  @RequestMapping("/search")
  @Secured({ "ROLE_USER" })
  public class SearchController  extends BaseController {
  @Autowired
  protected ISessionProvider sessionProvider; &lt;-- does work 
  @Autowired
  protected ISearcher searcher;
  </code></pre>
  
  <p>The last line throws exception because the constructor of Searcher (implementing ISearcher) tries to access sessionProvider, which is null.</p>
  
  <p>I am not sure what i might be doing wrong, it looks like spring doesn't autowire the ISessionProvider in Searcher. </p>
  
  <p>It might be that spring first autowires the Searcher in SearchController, but it should first autowire SessionProvider in Searcher and next autowire Searcher in SearchController. Cause searcher cannot be autowired without a valid SessionProvider. Puzzles my brain ;-)</p>
  
  <p>Can somebody offer a helping brain?</p>
  
  <p>[edit]</p>
  
  <ul>
  <li>component-scan includes my services, controllers and everything, just checked.</li>
  <li>the I before interfaces is indeed not very nice (old habits)</li>
  <li>not sure if this is a "duplicate" question, mainly because i'm not doing anything with "new", i let do spring do all the hard work, but i'll take a better peek.</li>
  </ul>