//获取ApplicationContext ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);//获取beancontext.getbean("xxx");希望可以帮到你