I have following controller method:
@RequestMapping(value = \"/owner/terminals/save\", method = RequestMethod.POST)
public String saveTerminal( @RequestParam
As I commented you are making things too complex. Change your wrapper to the following (with the appropriate getters and setters).
public class OnlyForImagesFileWrapper {
@Extensions(imageFormats = {".jpg",".png",".gif",".bmp"}, videoFormats = {})
private MultipartFile file;
private String name;
...
}
Then your controller method
@RequestMapping(value = "/owner/terminals/save", method = RequestMethod.POST)
public String saveTerminal( @ModelAttribute @Valid OnlyForImagesFileWrapper wrapper, BindingResult bindingResult ) { ... }
And of course in your configuration make sure you have a MultipartFileResolver
configured to properly handle the MultipartFile
argument as explained in the reference guide.