How can I overload a method with @QueryParam in Jersey/Spring?
This may not be feasible in Jersey, but Spring supports it. Here is your example code modified to work in Spring:
@GetMapping(value = "/test", produces = MediaType.TEXT_PLAIN_VALUE, params = "PID")
public String getText(@RequestParam("PID") String pid) {
return pid;
}
@GetMapping(value = "/test", produces = MediaType.TEXT_PLAIN_VALUE, params = { "PID", "NAME" })
public String getText(@RequestParam("PID") String pid, @RequestParam("NAME") String name) {
return pid + name;
}
See also: Overload path functions with different @QueryParams.