Reputation: 86757
How can I create a rest controller with spring-mvc
that takes multiple parameters with the same name? localhost:8080/api?id=12&id=15&id=88
//pseudocode
@RestController
public class MyRest {
@RequestMapping(method = RequestMethod.GET)
public Object test(@RequestParam value="ids" required=false) List<Integer> ids) {
Sysout(ids);
}
}
Upvotes: 2
Views: 2521
Reputation: 24433
?id=12&id=15&id=88
should work automatically with @RequestParam(value="id") List<Integer> ids
Upvotes: 7