因?yàn)閒ilter執(zhí)行時 還沒有加載@service等資源文件
所以需要在初始化時從全局context讀取并加載
@Override
public void init(FilterConfig config) throws ServletException {
ServletContext context = config.getServletContext();//這里獲取applicationContext
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(context);
menumoduleService = (IMenumoduleService) ctx.getBean(IMenumoduleService.class);
}