在过滤器中通过spring上下文获取bean

在过滤器中通过spring上下文获取bean

	public void init(FilterConfig arg0) throws ServletException {
		ApplicationContext appC=  WebApplicationContextUtils.getWebApplicationContext(arg0.getServletContext());
		DemoBean demoBean = (DemoBean)appC.getBean("demoBean");
	}

你可能感兴趣的:(spring)