我正在尝试创建一种REST API,其格式将接受JSON和MultipartFile类型的请求数据。
我的POJO类如下:
类别:组织
public class Organisation
{
priavet int org_id;
private MultipartFile organisationRegistrationDocument;
private Teachers[]
// getters and setters
}
班级:教师
class Teachers{
private String teacherId;
private MultipartFile teacherPhoto;
// getters and setters
}
我的控制器类如下:
@RequestMapping(value="/test",method=RequestMethod.POST,headers = {"content-type=multipart/mixed","content-type=multipart/form-data"})
private ResponseEntity<Object> testUpload(@RequestBody Organisation org) {
return null;
}
POSTMAN引发的错误:
{
"timestamp": "2018-10-03T07:38:30.439+0000",
"status": 400,
"error": "Bad Request",
"message": "Required request part 'org' is not present",
"path": "/test"
}
因此任何人都可以指导我我在做错什么,因为我不能达到预期的结果来处理上述形式的请求?