标签:spring java tab ati file static vat 响应 eth
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; /** * 日志跟踪记录接口参数及返回状态 * * @fileName CatResponseBodyAdvice.java * @Description * @author light-zhang * @date 2018年6月26日下午2:55:55 * @version 1.0.0 */ @Controller @ControllerAdvice public class CatResponseBodyAdvice implements ResponseBodyAdvice<ReturnMsg<?>> { private static final Logger logger = LoggerFactory.getLogger(CatResponseBodyAdvice.class); @Override public ReturnMsg<?> beforeBodyWrite(ReturnMsg<?> arg0, MethodParameter arg1, MediaType arg2, Class<? extends HttpMessageConverter<?>> arg3, ServerHttpRequest arg4, ServerHttpResponse arg5) { logger.info("方式:{},请求地址信息:{}", arg4.getMethod().name(), arg4.getURI().toString()); logger.info("请求函数名称:{},请求媒体类型信息:{}", arg1.getExecutable().getName(), arg2.toString()); logger.info("响应参数信息:{}", arg0); return arg0; } @Override public boolean supports(MethodParameter arg0, Class<? extends HttpMessageConverter<?>> arg1) { return true; } }
标签:spring java tab ati file static vat 响应 eth
原文地址:https://www.cnblogs.com/light-zhang/p/9229780.html