I have an endpoint that takes a request parameter: http://localhost/test?parameter=123 When somebody calls this endpoint with a string instead of an integer he gets a BAD_REQUEST response because the string can not be converted.
Is it possible to ignore conversion exceptions on a request parameter and just leave it empty?`
Currently my code looks like this:
@RequestMapping(value = "/test") public void doSomething(@RequestParam(required = false) Integer parameter) {...}