如果没有提供request body json,如何处理spring boot中pojo或bean类型的ResponseEntity自定义异常。我试图通过提供JSON形式的请求正文,从外部API中获取JSON形式的响应。我可以像下面这样做。但是如果没有提供请求体JSON,那么我需要像{ msg:"Request body is need“}那样给出JSON形式的响应 @PostMapping(value="/postdata",p
当我得到一个[org.springframework.http.converter.HttpMessageNotReadableException:...“时,它不会用JSON来响应,但是我仍然得到一个”已解析的HttpMessageNotReadableException“登录我的终端。我的异常处理程序类:public class PosterExceptionHandler extends ResponseEntityExceptionHandl
我有一个带有几个方法的控制器类,其中一个方法是接受POST请求的方法。当我尝试发送POST请求时,我得到一个错误消息: org.springframework.http.converter.HttpMessageNotReadableException: Requiredorg.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.j