在servlet中获取spring Bean对象

WebApplicationContext wc = WebApplicationContextUtils
    .getWebApplicationContext(request.getSession()
      .getServletContext());
 ICommonService cs = (ICommonService) wc.getBean("commonService");

你可能感兴趣的:(spring,bean,servlet)