SSH整合过程中,Action中无法获得service类的实例
我在spring里面配置了Action和service类的bean:
<!-- SysManageImpl -->
<bean id="sysManage" class="com.simpleton.CourseSystem.Service.SysManageImpl">
<property name="dao" ref="baseDao"></property>
</bean>
<!-- SysManagerAction -->
<bean name="/sysManagerAction" scope="prototype" class="com.simpleton.CourseSystem.Action.SysManagerAction">
<property name="sysManager" ref="sysManage"/>
</bean>
可是我在Action中用SysManageImpl 类的实例sysManage调用方法时,抛出空指针异常,我做了各种测试,都表明是sysManage没有实例化,我问过老师,老师说可能是Struts2和Spring整合过程有哪里出了问题,我想问Struts2和Spring整合过程需要注意哪些问题,还有就是sysManage没有实例化是什么原因?
//Action类
public class SysManagerAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private HttpServletRequest request;
private Student student;
private SysManageImpl sysManager;
//省略各setter和getter方法
public String add(){
try{
sysManager.sysUpdateStudent(student, operateType);
return "addSuccess";
}catch (Exception e) {
e.printStackTrace();
return "addFail";
}
}
}
bean name="/sysManagerAction"