servlet中施用spring
servlet中使用spring
ServletContext application; WebApplicationContext wac; application = getServletContext(); wac = WebApplicationContextUtils.getWebApplicationContext(application);// 获取spring的context BaseDaoImpl user = (BaseDaoImpl) wac.getBean("baseDaoImpl"); byte[] b = user.getBlob("{2d712e35-2be6-46cf-b702-1f47468d6042}", 5, 133, 28); PrintWriter out = response.getWriter(); out.print(b); out.flush();