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 @PathVariables 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>
With your current Spring version, you can try using _ as the delimiter and it should work fine.
I read this once in a Spring Documentation, but can't find the link right now, will add it as soon as I find it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With