Spring Boot项目中,对接口请求参数打印日志
public class CustomFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
// 打印请求参数
log.info("Request Params: " + httpServletRequest.getParameterMap());
chain.doFilter(request, response);
}
}