public class loginaction extends DispatchAction {

// @Resource
// private EmployeeInt  employeeInt;
// public void setEmployeeInt(EmployeeInt employeeInt) {
// this.employeeInt = employeeInt;
// }

public ActionForward login(ActionMapping mapping, ActionForm form,
HttpServletRequest arg2, HttpServletResponse arg3) throws Exception {
//  TODO Auto-generated method stub
ApplicationContext ac=new ClassPathXmlApplicationContext("ApplicationContext.xml");
EmployeeInt employeeInt=(EmployeeInt) ac.getBean("employeeImp");

Employee employee=new Employee();
Employeeform employeeform=(Employeeform)form;
employee.setId(Integer.parseInt(employeeform.getId()));
employee.setPwd(employeeform.getPwd());
Employee e=employeeInt.checkEmployee(employee);
if(e!=null){
System.out.println("login");
arg2.getSession().setAttribute("employee", e);
return mapping.findForward("ok");
}else{

return mapping.findForward("back");
}
}
}PS:为什么我用重新加载Spring容器后,就无法使用Hibernate.initialize(Department.class)和opensessioninview解决懒加载 ,但能用在department.hbm.xml中设置  lazy="false" 解决懒加载;使用 注解@Resource就没任何问题.