提交 78690a24 编写于 作者: S Sam Brannen

Add headers & name attributes to composed @RequestMapping annotations

Issue: SPR-13992
上级 ca8acc87
......@@ -33,8 +33,7 @@ import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
* <p>Specifically, {@code @DeleteMapping} is a <em>composed annotation</em> that
* acts as a shortcut for {@code @RequestMapping(method = RequestMethod.DELETE)}.
* Furthermore, this annotation does not support the
* {@link RequestMapping#method method}, {@link RequestMapping#name name},
* {@link RequestMapping#headers headers}, {@link RequestMapping#consumes consumes},
* {@link RequestMapping#method method}, {@link RequestMapping#consumes consumes},
* and {@link RequestMapping#produces produces} attributes of {@code @RequestMapping}.
*
* @author Sam Brannen
......@@ -51,6 +50,12 @@ import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
@RequestMapping(method = DELETE)
public @interface DeleteMapping {
/**
* Alias for {@link RequestMapping#name}.
*/
@AliasFor(annotation = RequestMapping.class)
String name() default "";
/**
* Alias for {@link RequestMapping#value}.
*/
......@@ -69,4 +74,10 @@ public @interface DeleteMapping {
@AliasFor(annotation = RequestMapping.class)
String[] params() default {};
/**
* Alias for {@link RequestMapping#headers}.
*/
@AliasFor(annotation = RequestMapping.class)
String[] headers() default {};
}
......@@ -33,9 +33,8 @@ import static org.springframework.web.bind.annotation.RequestMethod.GET;
* <p>Specifically, {@code @GetMapping} is a <em>composed annotation</em> that
* acts as a shortcut for {@code @RequestMapping(method = RequestMethod.GET)}.
* Furthermore, this annotation does not support the
* {@link RequestMapping#method method}, {@link RequestMapping#name name},
* {@link RequestMapping#headers headers}, and {@link RequestMapping#consumes
* consumes} attributes of {@code @RequestMapping}.
* {@link RequestMapping#method method} and {@link RequestMapping#consumes consumes}
* attributes of {@code @RequestMapping}.
*
* @author Sam Brannen
* @since 4.3
......@@ -51,6 +50,12 @@ import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RequestMapping(method = GET)
public @interface GetMapping {
/**
* Alias for {@link RequestMapping#name}.
*/
@AliasFor(annotation = RequestMapping.class)
String name() default "";
/**
* Alias for {@link RequestMapping#value}.
*/
......@@ -69,6 +74,12 @@ public @interface GetMapping {
@AliasFor(annotation = RequestMapping.class)
String[] params() default {};
/**
* Alias for {@link RequestMapping#headers}.
*/
@AliasFor(annotation = RequestMapping.class)
String[] headers() default {};
/**
* Alias for {@link RequestMapping#produces}.
*/
......
......@@ -33,9 +33,8 @@ import static org.springframework.web.bind.annotation.RequestMethod.PATCH;
* <p>Specifically, {@code @PatchMapping} is a <em>composed annotation</em> that
* acts as a shortcut for {@code @RequestMapping(method = RequestMethod.PATCH)}.
* Furthermore, this annotation does not support the
* {@link RequestMapping#method method}, {@link RequestMapping#name name},
* {@link RequestMapping#headers headers}, and {@link RequestMapping#produces
* produces} attributes of {@code @RequestMapping}.
* {@link RequestMapping#method method} and {@link RequestMapping#produces produces}
* attributes of {@code @RequestMapping}.
*
* @author Sam Brannen
* @since 4.3
......@@ -51,6 +50,12 @@ import static org.springframework.web.bind.annotation.RequestMethod.PATCH;
@RequestMapping(method = PATCH)
public @interface PatchMapping {
/**
* Alias for {@link RequestMapping#name}.
*/
@AliasFor(annotation = RequestMapping.class)
String name() default "";
/**
* Alias for {@link RequestMapping#value}.
*/
......@@ -69,6 +74,12 @@ public @interface PatchMapping {
@AliasFor(annotation = RequestMapping.class)
String[] params() default {};
/**
* Alias for {@link RequestMapping#headers}.
*/
@AliasFor(annotation = RequestMapping.class)
String[] headers() default {};
/**
* Alias for {@link RequestMapping#consumes}.
*/
......
......@@ -33,9 +33,8 @@ import static org.springframework.web.bind.annotation.RequestMethod.POST;
* <p>Specifically, {@code @PostMapping} is a <em>composed annotation</em> that
* acts as a shortcut for {@code @RequestMapping(method = RequestMethod.POST)}.
* Furthermore, this annotation does not support the
* {@link RequestMapping#method method}, {@link RequestMapping#name name},
* {@link RequestMapping#headers headers}, and {@link RequestMapping#produces
* produces} attributes of {@code @RequestMapping}.
* {@link RequestMapping#method method} and {@link RequestMapping#produces produces}
* attributes of {@code @RequestMapping}.
*
* @author Sam Brannen
* @since 4.3
......@@ -51,6 +50,12 @@ import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RequestMapping(method = POST)
public @interface PostMapping {
/**
* Alias for {@link RequestMapping#name}.
*/
@AliasFor(annotation = RequestMapping.class)
String name() default "";
/**
* Alias for {@link RequestMapping#value}.
*/
......@@ -69,6 +74,12 @@ public @interface PostMapping {
@AliasFor(annotation = RequestMapping.class)
String[] params() default {};
/**
* Alias for {@link RequestMapping#headers}.
*/
@AliasFor(annotation = RequestMapping.class)
String[] headers() default {};
/**
* Alias for {@link RequestMapping#consumes}.
*/
......
......@@ -33,9 +33,8 @@ import static org.springframework.web.bind.annotation.RequestMethod.PUT;
* <p>Specifically, {@code @PutMapping} is a <em>composed annotation</em> that
* acts as a shortcut for {@code @RequestMapping(method = RequestMethod.PUT)}.
* Furthermore, this annotation does not support the
* {@link RequestMapping#method method}, {@link RequestMapping#name name},
* {@link RequestMapping#headers headers}, and {@link RequestMapping#produces
* produces} attributes of {@code @RequestMapping}.
* {@link RequestMapping#method method} and {@link RequestMapping#produces produces}
* attributes of {@code @RequestMapping}.
*
* @author Sam Brannen
* @since 4.3
......@@ -51,6 +50,12 @@ import static org.springframework.web.bind.annotation.RequestMethod.PUT;
@RequestMapping(method = PUT)
public @interface PutMapping {
/**
* Alias for {@link RequestMapping#name}.
*/
@AliasFor(annotation = RequestMapping.class)
String name() default "";
/**
* Alias for {@link RequestMapping#value}.
*/
......@@ -69,6 +74,12 @@ public @interface PutMapping {
@AliasFor(annotation = RequestMapping.class)
String[] params() default {};
/**
* Alias for {@link RequestMapping#headers}.
*/
@AliasFor(annotation = RequestMapping.class)
String[] headers() default {};
/**
* Alias for {@link RequestMapping#consumes}.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册