Content type 'multipart/form-data;boundary=-....Ndzc1;charset=UTF-8' not supported

org.springframework.web.HttpMediaTypeNotSupportedException: 
Content type 'multipart/form-data;boundary=----WebKitFormBoundaryRAYPKeHKTYSNdzc1;charset=UTF-8' not supported
背景: springboot工程一个controller接口
@RestController
@RequestMapping("/admin/product/admingoods")
@Api(description = "商品接口")
@CrossOrigin
@Slf4j
public class AdmingoodsController {
	 @ApiOperation(value = "新增商品")  //表单提交,有文本有图片,数据都封装在Admingoods 实体类中
	 @PostMapping("/add")
	 public R save(@ApiParam(name = "admingoods", value = "商品对象", required = true) 
	 @RequestBody Admingoods admingoods) {
	   // do business
	}
}

当参数@RequestBody Admingoods admingoods加了@RequestBody时测试请求的时候就会报上面的错误
解决方法:将参数前面的@RequestBody去掉即可正常请求,具体原因有待研究...

你可能感兴趣的:(错误)