//获取service
GenericService genericService =(GenericService) getObjectFromApplication(e.getSession().getServletContext(),"genericService")
private Object getObjectFromApplication(ServletContext servletContext, String beanName){
//通过WebApplicationContextUtils 得到Spring容器的实例。
ApplicationContext application= WebApplicationContextUtils.getWebApplicationContext(servletContext);
//返回Bean的实例。
return application.getBean(beanName);
}