I have @RestController
with @RequestMapping("/api/my-resource")
. I have @GetMapping
for extracting certain entity.
@GetMapping(value = "/{firstId},{secondId}")
public ResponseEntity<MyResourceDTO> findMyResource(
@PathVariable Long firstId, @PathVariable String secondId) {
//here I have firstId == null and secondId == null
}
If I replace ,
with /
everything works fine, but the requirement is not to use another /
.
I can confirm, that I can enter this method, but both @PathVariable
s are mapped to null. Does Spring
support this kind of mapping? What have I done wrong?
I would like to achieve something similar to this, but I must use Spring
.
Edit:
I have seen the solution with List
but I don't want to use it, as the ids are of different type, so it's not a duplicate. I'm using <spring.version>4.3.6.RELEASE</spring.version>