异常统一处理的切面

package com.djhu.followup.control.advice;

import com.djhu.followup.entity.dto.ResultResp;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**

  • @Author zw

  • @DATE 2019/6/5 9:19

  • @VERSION 1.0.0
    **/
    @ControllerAdvice
    public class ControlAdvice {

    @ExceptionHandler(value = Exception.class)
    public ResultResp handleException(Exception e){
    ResultResp resultResp = ResultResp.failed(400,e.getMessage());
    return resultResp;
    }

}

发布了13 篇原创文章 · 获赞 3 · 访问量 2058

猜你喜欢

转载自blog.csdn.net/qq_33337186/article/details/95458492