Annotation Type Get


@Target(METHOD) @Retention(RUNTIME) public @interface Get
Marks a method that handles HTTP GET requests.


   @Get("{id}")
   Customer get(long id) {

     ...
   }

 

Example

Path parameters are matched by name - "status" in the example below.

Method parameters that do not match a path parameter default to being a query parameter - "since" is a query parameter in the example below.



   @Get("/status/{status}")
   List<Customer> getByStatus(String status, LocalDate since) {

     ...
   }

 

Example - Multiple path parameters



   @Get("/status/{status}/{parentId}")
   List<Customer> getByStatus(String status, long parentId, LocalDate since) {

     ...
   }

 
  • Element Details

    • value

      String value
      Specify the path.
      Default:
      ""
    • instrumentRequestContext

      boolean instrumentRequestContext
      Default:
      false