Why it failed when combining @component and bean?
<p>I am trying to use @component and regular beans. And below is my code:</p>

<p><strong>MainApp.java</strong></p>

<pre><code>package com.company;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MainApp {
   public static void main(String[] args) {
      ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");

      TextEditor te = (TextEditor) context.getBean("textEditor");

      te.spellCheck();
   }
}
</code></pre>

<p><strong>SpellChecker.java</strong></p>

<pre><code>package com.company;

public class SpellChecker {
   public SpellChecker(){
      System.out.println("Inside SpellChecker constructor." );
   }

   public void checkSpelling(){
      System.out.println("Inside checkSpelling." );
   }
}
</code></pre>

<p><strong>TextEditor.java</strong></p>

<pre><code>package com.company;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class TextEditor {
   @Autowired
   private SpellChecker spellChecker;
   @Autowired
   @Qualifier("region")
   private String region;

   public TextEditor() {
      System.out.println("I am in " + region );
   }

   public SpellChecker getSpellChecker( ){
      return spellChecker;
   }

   public void spellCheck(){
      spellChecker.checkSpelling();
   }
}
</code></pre>

<p><strong>Beans.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;

   &lt;context:annotation-config/&gt;
   &lt;context:component-scan base-package="com.company" /&gt;

   &lt;bean id="spellChecker" class="SpellChecker" /&gt;

   &lt;bean id="region" class="java.lang.String"&gt;
      &lt;constructor-arg value="Vancouver" /&gt;
   &lt;/bean&gt;

&lt;/beans&gt;
</code></pre>

<p>However, when I run this code, it gave error messages:</p>

<pre><code>Cannot find class [SpellChecker] for bean with name 'spellChecker' defined in class path resource
</code></pre>

<p>When I remove the bean in the Beans.xml for SpellChecker and mark @component to it as well. Then it works (yet, the region String is still empty). </p>

<p>So my question is: why cannot we autowired a bean in a @Component class?</p>