I would like to validate input of following @RequestMapping
:
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public Response getCategory(@PathVariable("id") Long id) {
// some logic here
}
When consumer of the endpoint passes string following error occurs:
Failed to convert value of type [java.lang.String] to required type [java.lang.Long]; nested exception is java.lang.NumberFormatException: For input string: "null"
I could change it to string but I believe there is a better way to do it.