filter (过滤器)中注入service


@Override
public void init(FilterConfig filterConfig) throws ServletException {
ServletContext sc = filterConfig.getServletContext();
WebApplicationContext cxt = WebApplicationContextUtils.getWebApplicationContext(sc);
if(cxt != null) {
if (publicService == null) {
publicService = cxt.getBean(PublicService.class);
}
}
}

filter (过滤器)中注入service

上一篇:yarn 简单介绍


下一篇:寻觅[Getting Answers]