1)通过session获取spring上下文:
ServletContext context = request.getSession().getServletContext();
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(context);
yourService = (YourService)ctx.getBean("yourService");
1)通过session获取spring上下文:
ServletContext context = request.getSession().getServletContext();
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(context);
yourService = (YourService)ctx.getBean("yourService");