Spring Auto Wire byType如何在春季设置bean?

Spring Auto Wire byType如何在春季设置bean?,spring,Spring,这是我的applicationContext.xml配置 <bean name="foo" class="com.bmc.repository.HibernateCustomerRepositoryImpl"> </bean> <bean name="customerService" class="com.bmc.service.CustomerServiceImpl"

这是我的
applicationContext.xml
配置

<bean name="foo" 
      class="com.bmc.repository.HibernateCustomerRepositoryImpl">
</bean>

<bean name="customerService" class="com.bmc.service.CustomerServiceImpl" autowire="byType">
</bean>
customerService bean依赖于HibernateCustomerRepositoryImpl

因此,我的问题是:

1.spring将如何将HibernateCostomerRepositoryImpl bean与CustomerService绑定?使用setter方法

2.如果是,方法的名称应该是什么?它应该是setPropertyName还是setBeanName

3.Spring将如何找到setter方法?使用匹配的参数类型


public class CustomerServiceImpl implements CustomerService {

    private CustomerRepository customerRepository;

    public void setFoo(CustomerRepository b) {
        this.customerRepository = b;
    }
}
<bean name="foo" id="foo" 
      class="com.bmc.repository.HibernateCustomerRepositoryImpl">
</bean>
<bean name="customerService" class="com.bmc.service.CustomerServiceImpl" autowire="byType">
    <property name="foo" ref="foo"></property>
</bean>