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