This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Jul 28 09:23:26 CST 2023 There was an unexpected error (type=Bad Request, status=400). Required request body is missing: public com.example.mybatisplus.common.JsonResponse com.example.mybatisplus.web.controller.CommentController.updateComment(com.example.mybatisplus.model.domain.Comment) org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public com.example.mybatisplus.common.JsonResponse com.example.mybatisplus.web.controller.CommentController.updateComment(com.example.mybatisplus.model.domain.Comment)为什么内容:这个错误是因为你的应用程序的控制器方法需要一个请求体,但是请求中缺少了这个请求体。在你的应用程序的控制器类中,你需要为这个方法添加一个@RequestBody注解,以指示请求体的类型和名称。例如:

@PostMapping("/comments/update")
public JsonResponse updateComment(@RequestBody Comment comment) {
    // 处理更新评论的逻辑
}

注意,Comment类需要在com.example.mybatisplus.model.domain包中存在,并且需要有与请求体相对应的属性。

如果你的请求确实包含请求体,但仍然出现这个错误,可能是因为请求体的格式不正确或不符合期望的类型。请确保请求体的格式正确,并且与控制器方法中定义的参数类型匹配。


原文地址: https://www.cveoy.top/t/topic/p339 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录