@RequestMapping(value = {\"/abcd\", \"/employees/{value}/{id}\"})
public String getEmployees(
@PathVariable(value = \"value\") String val,
@PathVariable(val
I had a similar problem and I found this solution:
@GetMapping(value = {"/clients/page", "/clients/page/{page}"})
public Page index(@PathVariable Optional page) {
PageRequest pageRequest = page.map(integer -> PageRequest.of(integer, 4))
.orElseGet(() -> PageRequest.of(0, 4));
return clientService.showAll(pageRequest);
}
Intellij helped me to get this kind of compact result. Although Intellij throw this message:
''Reports any uses of java.util.Optional, java.util.OptionalDouble, java.util.OptionalInt, java.util.OptionalLong or com.google.common.base.Optional as the type for a field or a parameter. Optional was designed to provide a limited mechanism for library method return types where there needed to be a clear way to represent "no result". Using a field with type java.util.Optional is also problematic if the class needs to be Serializable, which java.util.Optional is not. ''
To be honest, I'm new in this business and I don't understand clearly what the IDE is telling me. If someone with more expertise could help to clarify that message would be great.