I need to add a '-' in the path parameter name, because of the backward compatibility of our project.
@GetMapping("employees")
public ResponseEntity<Object> getEmployeesBySelection(@PathParam("page-size") Optional < Integer> page_size)
{
ResponseEntity.ok(page_size.orElse(0));
}
If it is set up like this it returns an empty object. (the reason for use of Optional)
I found a similar question on this site but it looked like they were all just trying to solve it by transforming the pathParam into camel-case via a custom request wrapper.
Is there some kind of general solution to enable spring to recognize pathParams with '-' as written above?