M(dao)进行实际操作 service调dao,contronller(action)调用service,service依赖(调用)dao,action调用service
目录结构
service中必须有dao的set get方法,action中必须有service的setget方法,且属性名应与xml中配置的一致
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<beans>
<bean id="user" class="com.bean.User" ></bean>
<bean id="udao" class="com.dao.UserDaoImpl" ></bean>
<bean id="uservice" class="com.service.UserServiceImpl" >
<property name="udao" ref="udao"></property>
</bean>
<bean id="uaction" class="com.action.UserAction" >
<property name="service" ref="uservice"></property>
</bean>
</beans>
</beans>
【类中变量名必须和xml中一致!!!!!!!】