@RequestMapping(value = {\"/abcd\", \"/employees/{value}/{id}\"})
public String getEmployees(
@PathVariable(value = \"value\") String val,
@PathVariable(val
You can now have optional path variables via support for Java 8 Optional. At least Spring version 4.x will be required.
@RequestMapping({"/abcd", "/employees/{value}/{id}"})
public String getEmployees(
@PathVariable("value") Optional val,
@PathVariable("id") Optional id,
@RequestParam("param") Optional value
) {
// ********
}
N.B. this doesn't work with the optional primitives (OptionalInt
, etc.).