Spring boot 输出@Requestbody和@Responsebody的弹簧启动时间

Spring boot 输出@Requestbody和@Responsebody的弹簧启动时间,spring-boot,aspect,exceptionhandler,Spring Boot,Aspect,Exceptionhandler,我尝试使用@aspect来输出请求正文,但是如果使用@valid时参数错误,spring boot将抛出MethodArgumentNotValidException,并且@aspect日志将不会输出 当服务器接收到http请求时,即使发生异常,如何输出json请求正文 我用@afterhrowing修复了这个问题 @Before("within(control..*)") public void before(JoinPoint joinPoint) { // Set Process

我尝试使用@aspect来输出请求正文,但是如果使用@valid时参数错误,spring boot将抛出MethodArgumentNotValidException,并且@aspect日志将不会输出


当服务器接收到http请求时,即使发生异常,如何输出json请求正文

我用@afterhrowing修复了这个问题

@Before("within(control..*)")
public void before(JoinPoint joinPoint) {
    // Set Process Start Time
    startTime = System.currentTimeMillis();
    Object[] arguments = joinPoint.getArgs();
    if (arguments != null && arguments.length > 0) {
        System.out.println("data:" + arguments[0]);
    }
}
@AfterThrowing(pointcut = "controllerInvocation()", throwing = "exception")
public void afterThrowing(JoinPoint joinPoint, Exception exception) {
    this.outputResponseLog(joinPoint, exception);
}