'Spring RequestMapping only maps one RequestParameter

Hi i have an endpoint with multiple Request Parameters

@GetMapping(produces = {MediaType.APPLICATION_JSON_VALUE}, value = "/somepath")
SomeDTO getSomething(
@ApiParam(value = "Some filter one", required = true) @RequestParam(required = false, value = "propertyId") String propertyId,
@ApiParam(value = "Some filter two", required = false) @RequestParam(required = false, value = "otherPropertyId") String otherPropertyId){
...
}

When i invoke endpoint with only one parameter like

wget http://localhost:8085/somepath?propertyId=3016868

I see in the logs that propertyId is 3016868.

But when i use both parameters like

wget http://localhost:8085/somepath?propertyId=3016868&otherPropertyId=3016867

I see in the logs that propertyId is 3016868 but otherPropertyId is null

When i switch the paramters

wget http://localhost:8085/somepath?otherPropertyId=3016868&propertyId=3016867

I see in the logs that otherPropertyId is 3016868 but propertyId is null

So it seems to me that only first parameter is mapped. Has anyone a clue why ?



Solution 1:[1]

Problem was that you have to put the url in Qutation Marks. Then all parameters are mapped. Its not a Spring Problem

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3036353