开发者社区 问答 正文

spring mvc怎样在filter中获得bean?

spring mvc怎样在filter中获得bean?

展开
收起
a123456678 2016-03-18 10:46:03 2520 分享 版权
1 条回答
写回答
取消 提交回答
  • ServletContext context = config.getServletContext();
    ApplicationContext ac = WebApplicationContextUtils

                .getWebApplicationContext(context);

    TestBean testBean = (TestBean) ac.getBean("testBean");

    2019-07-17 19:06:08
    赞同 展开评论