spring4.3.8 XML文件的bean id与AutoWritingService 的属性完全不对应,也可以执行,为什么?
package BeanAutoWriting;
public class AutoWritingService {
private AutoWritingDAO autoWritingDAO1;
public void setAutoWritingDAO1(AutoWritingDAO autoWritingDAO) {
System.out.println("执行set方法");
this.autoWritingDAO1 = autoWritingDAO;
}
public void say(String word) {
this.autoWritingDAO1.say(word);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd"
default-autowire="byType" >
<!--id标识 class权限命名 -->
<bean id="autoWritingService" class="BeanAutoWriting.AutoWritingService"></bean>
<bean id="autoWriting" class="BeanAutoWriting.AutoWritingDAO"></bean>
</beans>