Commit 566bbae1 authored by 夏敏伟's avatar 夏敏伟

Merge branch 'master' of http://192.168.168.218/wcyuee/szpt

parents 7f7fe763 8a5e1514
This diff is collapsed.
......@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
......@@ -43,6 +44,16 @@ public class GlobalExceptionHandler {
return new HttpResult<>(state);
}
//请求映射问题
@ExceptionHandler(value = HttpMediaTypeNotSupportedException.class)
@ResponseBody
public HttpResult<HttpResultState> handleHttpMediaTypeNotSupportedException(HttpServletRequest req, Exception e) {
logger.error("错误信息如下:", e);
HttpResultState state = HttpResultState.NOTIFICATION;
state.setMessage(e.getMessage());
return new HttpResult<>(state);
}
//not found
@ResponseBody
@ExceptionHandler(value = {NotFoundException.class, NoHandlerFoundException.class})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment