@Target(value=PARAMETER)
@Retention(value=RUNTIME)
@Documented
public @interface PathVariable
RequestMapping
annotated handler methods.
If the method parameter is Map<String, String>
then the map is populated with all path variable names and values.
RequestMapping
,
RequestMappingHandlerAdapter
public abstract boolean required
Defaults to true
, leading to an exception being thrown if the path
variable is missing in the incoming request. Switch this to false
if
you prefer a null
or Java 8 java.util.Optional
in this case.
e.g. on a ModelAttribute
method which serves for different requests.