Package org.springframework.web.bind.annotation

# Annotation Interface GetMapping

@Target(METHOD) @Retention(RUNTIME) @Documented @RequestMapping(method=GET) public @interface GetMapping
Annotation for mapping HTTP `GET` requests onto specific handler methods.

Specifically, `@GetMapping` is a composed annotation that acts as a shortcut for `@RequestMapping(method = RequestMethod.GET)`.

NOTE: This annotation cannot be used in conjunction with other `@RequestMapping` annotations that are declared on the same method. If multiple `@RequestMapping` annotations are detected on the same method, a warning will be logged, and only the first mapping will be used. This applies to `@RequestMapping` as well as composed `@RequestMapping` annotations such as `@PutMapping`, `@PostMapping`, etc.

Since:
  4.3
Author:
  Sam Brannen
See Also:
  - `PostMapping`
  - `PutMapping`
  - `DeleteMapping`
  - `PatchMapping`
  - `RequestMapping`

## Optional Element Summary

Optional Elements
Modifier and Type
Optional Element
Description
`String[]`
`consumes`
Alias for `RequestMapping.consumes()`.
`String[]`
`headers`
Alias for `RequestMapping.headers()`.
`String`
`name`
Alias for `RequestMapping.name()`.
`String[]`
`params`
Alias for `RequestMapping.params()`.
`String[]`
`path`
Alias for `RequestMapping.path()`.
`String[]`
`produces`
Alias for `RequestMapping.produces()`.
`String[]`
`value`
Alias for `RequestMapping.value()`.

## Element Details

### name

@AliasFor(annotation=RequestMapping.class) String name
Alias for `RequestMapping.name()`.

Default:
  ""

### value

@AliasFor(annotation=RequestMapping.class) String[] value
Alias for `RequestMapping.value()`.

Default:
  {}

### path

@AliasFor(annotation=RequestMapping.class) String[] path
Alias for `RequestMapping.path()`.

Default:
  {}

### params

@AliasFor(annotation=RequestMapping.class) String[] params
Alias for `RequestMapping.params()`.

Default:
  {}

### headers

@AliasFor(annotation=RequestMapping.class) String[] headers
Alias for `RequestMapping.headers()`.

Default:
  {}

### consumes

@AliasFor(annotation=RequestMapping.class) String[] consumes
Alias for `RequestMapping.consumes()`.

Since:
  4.3.5

Default:
  {}

### produces

@AliasFor(annotation=RequestMapping.class) String[] produces
Alias for `RequestMapping.produces()`.

Default:
  {}