获取 web容器中的bean
public class WebContextBeanFinder {
public static Object getBean(String beanId) {
ServletContext servletContext = ServletActionContext.getServletContext();
WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
return context.getBean(beanId);
}
}
浙公网安备 33010602011771号