我在Spring RestController
中有方法:
@RequestMapping(value = "/mapping", method = { RequestMethod.POST }, consumes = "multipart/form-data")
public ResponseEntity fileQuery(MyRequest request) {}
一堂课,MyRequest
:
public class MyRequest{
private String url;
private String method;
private String body;
private MultipartFile file;
// I have tried with MultiValueMap and no result
private Map<String,String> formData;
//getters and setters here
}
我想创建一个方法,使用以下已知参数接受multipart / form-data请求: