add another defaultpathvariable method
This commit is contained in:
parent
6ced667bd5
commit
c4770ac40f
@ -66,6 +66,16 @@ public class PathVariableAnnotationController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = { "/api/defaultemployeeswithoptional", "/api/defaultemployeeswithoptional/{id}" })
|
||||
@ResponseBody
|
||||
public String getDefaultEmployeesByIdWithOptional(@PathVariable Optional<String> id) {
|
||||
if (id.isPresent()) {
|
||||
return "ID: " + id.get();
|
||||
} else {
|
||||
return "ID: Default Employee";
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = { "/api/employeeswithmap/{id}", "/api/employeeswithmap" })
|
||||
@ResponseBody
|
||||
public String getEmployeesByIdWithMap(@PathVariable Map<String, String> pathVarsMap) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user