There is fundamental difference between query parameters and path parameters. It goes like this:
www.your_domain?queryparam1=1&queryparam2=2
- query parameters.
www.your_domain/path_param1/entity/path_param2
- path parameters.
What I found surprising is that in Spring MVC world a lot of people confuse one for the other.
While query parameters are more like criteria for a search, path params will most likely uniquely identify a resource. Having said that, it doesn't mean that you can't have multiple path parameters in your URI, because the resource structure can be nested. For example, let's say you need a specific car resource of a specific person:
www.my_site/customer/15/car/2
- looking for a second car of a 15th customer.
What would be a usecase to put all path parameters into a map? Path parameters don't have a "key" when you look at a URI itself, those keys inside the map would be taken from your @Mapping annotation, for example:
@GetMapping("/booking/{param1}/{param2}")
From HTTP/REST perspective path parameters can't be projected onto a map really. It's all about Spring's flexibility and their desire to accommodate any developers whim, in my opinion.
I would never use a map for path parameters, but it can be quite useful for query parameters.