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>
搞错了