How to validate request parameter if it is not a bean in spring MVC?
问题 Below is a POST end point in my spring MVC REST service. I want to use spring validation frame work to make sure that list I receive is not empty. How do I do it? Do I have to provide wrapper bean to around listOfLongs ? @RequestMapping(value = "/some/path", method = RequestMethod.POST) @ResponseBody public Foo bar(@Valid @NotEmpty @RequestBody List<Long> listOfLongs) { /* if (listOfLongs.size() == 0) { throw new InvalidRequestException(); } */ // do some useful work } What should be the