(踩坑之路)@RequestBody传对象

在postmen上使用@RequestBody传对象,接受不到参数。
报错:
{
“timestamp”: 1542330043448,
“status”: 400,
“error”: “Bad Request”,
“exception”: “org.springframework.http.converter.HttpMessageNotReadableException”,
“message”: “Required request body is missing: public java.lang.String cn.axy.xc.xcshoppingprovider.controller.ShoppingController.addShopping(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,cn.axy.xc.xcshoppingprovider.pojo.ShoppingCart,java.lang.Long)”,
“path”: “/addShopping”
}
(踩坑之路)@RequestBody传对象_第1张图片

怎么解决呢?

原因是传参方式不对,在postman中使body传参
(踩坑之路)@RequestBody传对象_第2张图片

你可能感兴趣的:(坑)