Getting null with @pathparam and @requestmapping

The annotation to get path variable is @PathVariable. It looks like you have used @PathParam instead which is incorrect.

Check this out for more details:

requestparam-vs-pathvariable


As above answers already mentioned @PathVariable should be used, I thought to clear the confusion between @PathVariable & @PathParam.

Most people get confused on this part because Spring and other rest implementation like Jersey use sightly different annotations for the same thing.

@QueryParam in Jersey is @RequestParam in Spring Rest API.

@PathParam in Jersey is @PathVariable in Spring Rest API.

Tags:

Spring Boot