关于注入机制的例子
在applicationContext.xml 文件中,把struts 注入到spring中
在<!-- Service Configuration -->中
<ref bean="telListDAO" /> 对应的是
<!-- Dao Configuration -->
<bean id="telListDAO" name="telListDAO"
而<!-- Service Configuration -->中
<property name="tellist">
对应的是action中的
class="com.et.dao.impl.TelListDAO" 对应的是建立action 的时候类似
<action path="/fdfd" type="com.yourcompany.struts.action.FdfdAction" /> 的type=后面跟的值
看另外的一个注入的例子
在applicationContext.xml 文件中,把struts 注入到spring中
<!-- Dao Configuration -->
<bean id="telListDAO" name="telListDAO"
class="com.et.dao.impl.TelListDAO" abstract="false" singleton="true"
lazy-init="default" autowire="default" dependency-check="default">
<property name="hibernateHelper">
<ref bean="hibernateHelper" />
</property>
</bean>
<!-- Service Configuration -->
<bean name="/tellist"
class="com.et.struts.action.TellistAction" singleton="false">
<property name="tellist">
<ref bean="telListDAO" />
</property>
</bean>
在<!-- Service Configuration -->中
<ref bean="telListDAO" /> 对应的是
<!-- Dao Configuration -->
<bean id="telListDAO" name="telListDAO"
而<!-- Service Configuration -->中
<property name="tellist">
对应的是action中的
private TelListDAO tellist;
. public TelListDAO getTellist() {
return tellist;
}
public void setTellist(TelListDAO tellist) {
this.tellist = tellist;
}
class="com.et.dao.impl.TelListDAO" 对应的是建立action 的时候类似
<action path="/fdfd" type="com.yourcompany.struts.action.FdfdAction" /> 的type=后面跟的值
看另外的一个注入的例子
<!-- Dao Configuration -->
<bean id="checkTimeBookDAO" name="checkTimeBookDAO"
class="com.et.dao.impl.CheckTimeBookDAO" abstract="false" singleton="true"
lazy-init="default" autowire="default" dependency-check="default">
<property name="hibernateHelper">
<ref bean="hibernateHelper" />
</property>
</bean>
<!-- Service Configuration -->
<bean id="logInOutService" name="logInOutService"
class="com.et.service.impl.LogInOutService" >
<property name="checkTimeBookDAO">
<ref bean="checkTimeBookDAO" />
</property>
<!--坐席 -->
<bean name="/agent"
class="com.et.struts.action.AgentAction" singleton="false">
<property name="agentsDAO">
<ref bean="agentsDAO" />
</property>
<property name="groupDAO">
<ref bean="groupDAO" />
</property>
<property name="agrelationDAO">
<ref bean="agrelationDAO" />
</property>
<property name="checkTimeBookDAO">
<ref bean="checkTimeBookDAO" />
</property>
</bean>