title: @Autowire failing with @Repository
body: <p>I am not being able to make @Autowire annotation work with a @Repository annotated class.</p>
  
  <p>I have an interface:</p>
  
  <pre><code>public interface AccountRepository {
      public Account findByUsername(String username);
      public Account findById(long id);
      public Account save(Account account);
  }
  </code></pre>
  
  <p>And the class implementing the interface <strong>annotated with @Repository</strong>:</p>
  
  <pre><code>@Repository
  public class AccountRepositoryImpl implements AccountRepository {
      public Account findByUsername(String username){
          //Implementing code
      }
      public Account findById(long id){
          //Implementing code            
      }
      public Account save(Account account){
          //Implementing code
      }
  }
  </code></pre>
  
  <p>In another class, I need to use this repository to find an account by the username, so I am using autowiring, but I am checking if it works and the accountRepository instance <strong>is always null</strong>:</p>
  
  <pre><code>@Component
  public class FooClass {
      @Autowired
      private AccountRepository accountRepository;
  
      ...
  
      public barMethod(){
          logger.debug(accountRepository == null ? "accountRepository is NULL" : "accountRepository IS NOT NULL");
      }
  }
  </code></pre>
  
  <p>I have also set the packages to scan for the components  (<code>sessionFactory.setPackagesToScan(new String [] {"com.foo.bar"});</code>), and it does autowire other classes annotated with @Component for instance, but in this one annotated with @Repository, it is always null.</p>
  
  <p>Am I missing something?</p>