获取 web容器中的bean

public class WebContextBeanFinder {

public static Object getBean(String beanId) {
ServletContext servletContext = ServletActionContext.getServletContext();
WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
return context.getBean(beanId);
}
}

posted on 2014-01-07 17:14  a_badegg  阅读(150)  评论(0编辑  收藏  举报

导航