How I can pass a Map parameter as a GET param in url to Spring REST controller ?
It’s possible to bind all request parameters in a Map just by adding a Map object after the annotation:
@RequestMapping("/demo")
public String example(@RequestParam Map<String, String> map){
String apple = map.get("APPLE");//apple
String banana = map.get("BANANA");//banana
return apple + banana;
}
Request
/demo?APPLE=apple&BANANA=banana
Source -- https://reversecoding.net/spring-mvc-requestparam-binding-request-parameters/