spring auto-wire failed when inject a dependent bean into a @component java class
<p>I have a Service class with @Component annotation, and this bean dependent a DAO like this:</p>

<pre><code>@Component
public class CustomerService
{

    @Setter
    private CustomerDAO customerDAO;

}
</code></pre>

<p>and XML file goes like this:</p>

<pre><code>&lt;context:component-scan base-package="com.mkyong.customer" /&gt;
&lt;bean id="customerDAO" class="com.mkyong.customer.dao.CustomerDAO" autowire="byName"&gt;&lt;/bean&gt;
</code></pre>

<p>But, after the app is running, the field customerDAO can't been injected. If I replace <code>@Setter</code> with <code>@Resource</code>, that's will be fine. I deeply wonders, why the <code>@Componet</code> bean can't be injected with setter methods.</p>

<p>I'm using Spring 2.5.6;</p>