有时Servlet中会用到spring容器中的bean,用法如下: ApplicationContext context = WebApplicationContextUtils .getWebApplicationContext(getServletContext()); context.getBean("accLibService");