I have a spring web 4.3.4 app with a REST endpoint:
@RequestMapping(value = "/doStuff", method = RequestMethod.GET)
public ResponseEntity<MyDTO[]> findSomething(@RequestParam(value = "status")
Optional<Set<EnumStatus>> statusFilter)
{
[...];
}
I call it like this: http://localhost:8080/rest/api/doStuff?status=CREATED&status=ACTIVATED
I expected the value of statusFilter to be:
Optional { Set {EnumStatus.CREATED, EnumStatus.ACTIVATED}}
Instead I got:
Optional { Set {EnumStatus.CREATED}}
Turns out Spring is using the ArrayToObjectConverter, reducing the two values to a single one.
Is there a way around this? Is this a bug or expected behaviour?