原因:在请求指定url之外还请求了/favicon.ico 地址 过滤掉问题就解决了
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest=(HttpServletRequest) request;
//favicon 不请求 否则给人执行两次的错觉
if(!httpServletRequest.getRequestURI().contains("favicon.ico")){
System.out.println(httpServletRequest.getRequestURI());
chain.doFilter(request,response);
}
}
}