org.springframework.web.bind.annotation

## Annotation Type PathVariable

-     @Target(value=PARAMETER)
       @Retention(value=RUNTIME)
       @Documented
      public @interface PathVariable

  Annotation which indicates that a method parameter should be bound to a URI template variable. Supported for `RequestMapping` annotated handler methods.

  If the method parameter is `Map<String, String>` then the map is populated with all path variable names and values.

  Since:
    3.0
  Author:
    Arjen Poutsma, Juergen Hoeller
  See Also:
    `RequestMapping`, `RequestMappingHandlerAdapter`

- - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `String` | `name` The name of the path variable to bind to.
    `boolean` | `required` Whether the path variable is required.
    `String` | `value` Alias for `name()`.

- - ### Element Detail

    - #### value

          @AliasFor(value="name")
          public abstract String value

      Alias for `name()`.
      Default:
        ""

  - - #### name

          @AliasFor(value="value")
          public abstract String name

      The name of the path variable to bind to.
      Since:
        4.3.3
      Default:
        ""

  - - #### required

          public abstract boolean required

      Whether the path variable is 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.

      Since:
        4.3.3
      Default:
        true