Spring获取配置的bean

import javax.servlet.ServletContext;

ServletContext servletContext = actionServlet.getServletContext();
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
this.petStore = (PetStoreFacade) wac.getBean("petStore");

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