Spring MultipartFile validation and conversion
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I currently have a Spring MVC controller that takes a MultipartFile @RequestMapping(method = RequestMethod.POST) public String doUpload(@RequestParam("file") final MultipartFile file) { /* ... */ } The file contains csv data which will be used, one per row, to create a list of domain objects. This is working. I have written a converter for the line data: class MyObjectConverter implements org.springframework...Converter { /* ... */ } And a Validator for the file class UploadFileValidator implements org.springframework.validation.Validator {