一:spring setter注入
spring加载配置文件时会调用
public void setCustomerService(CustomerService customerService) {
this.customerService = customerService;
}
set方法将customerService 注入
换成注解注解方式@Autowired就可以移除<property name="customerService" ref="customerService"></property>
变为
二: 注解 <context:annotation-config/>
与<context:component-scan/>
1:
2: