您需要使用
@RequestPart而不是
@RequestParam和set
consumes属性:
@RequestMapping(value = "/file",method = RequestMethod.POST, consumes = "multipart/form-data")@ResponseBodypublic ResponseEntity<String> addUser(@RequestPart("uploadFile") MultipartFile file, @RequestPart("info") ExampleModel model){}您还需要调整
FormData对象:
formData.append('uploadFile', file, file.name);formData.append('info', new Blob([JSON.stringify(this.model)], { type: "application/json" }));


