Skip to content

Commit

Permalink
Polish documentation for @⁠RequestMapping
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Jan 17, 2024
1 parent 46128cb commit 5bf74ca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ attributes with a narrower, more specific purpose.
`@GetMapping`, `@PostMapping`, `@PutMapping`, `@DeleteMapping`, and `@PatchMapping` are
examples of composed annotations. They are provided, because, arguably, most
controller methods should be mapped to a specific HTTP method versus using `@RequestMapping`,
which, by default, matches to all HTTP methods. If you need an example of composed
annotations, look at how those are declared.
which, by default, matches to all HTTP methods. If you need an example of how to implement
a composed annotation, look at how those are declared.

Spring WebFlux also supports custom request mapping attributes with custom request matching
logic. This is a more advanced option that requires sub-classing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ attributes with a narrower, more specific purpose.
`@GetMapping`, `@PostMapping`, `@PutMapping`, `@DeleteMapping`, and `@PatchMapping` are
examples of composed annotations. They are provided because, arguably, most
controller methods should be mapped to a specific HTTP method versus using `@RequestMapping`,
which, by default, matches to all HTTP methods. If you need an example of composed
annotations, look at how those are declared.
which, by default, matches to all HTTP methods. If you need an example of how to implement
a composed annotation, look at how those are declared.

Spring MVC also supports custom request-mapping attributes with custom request-matching
logic. This is a more advanced option that requires subclassing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,7 +31,7 @@
*
* <p>Both Spring MVC and Spring WebFlux support this annotation through a
* {@code RequestMappingHandlerMapping} and {@code RequestMappingHandlerAdapter}
* in their respective modules and package structure. For the exact list of
* in their respective modules and package structures. For the exact list of
* supported handler method arguments and return types in each, please use the
* reference documentation links below:
* <ul>
Expand All @@ -47,16 +47,16 @@
* </li>
* </ul>
*
* <p><strong>Note:</strong> This annotation can be used both at the class and
* <p><strong>NOTE:</strong> This annotation can be used both at the class and
* at the method level. In most cases, at the method level applications will
* prefer to use one of the HTTP method specific variants
* {@link GetMapping @GetMapping}, {@link PostMapping @PostMapping},
* {@link PutMapping @PutMapping}, {@link DeleteMapping @DeleteMapping}, or
* {@link PatchMapping @PatchMapping}.</p>
* {@link PatchMapping @PatchMapping}.
*
* <p><b>NOTE:</b> When using controller interfaces (e.g. for AOP proxying),
* make sure to consistently put <i>all</i> your mapping annotations - such as
* {@code @RequestMapping} and {@code @SessionAttributes} - on
* make sure to consistently put <i>all</i> your mapping annotations &mdash; such
* as {@code @RequestMapping} and {@code @SessionAttributes} &mdash; on
* the controller <i>interface</i> rather than on the implementation class.
*
* @author Juergen Hoeller
Expand Down Expand Up @@ -87,21 +87,17 @@
String name() default "";

/**
* The primary mapping expressed by this annotation.
* The path mapping URIs &mdash; for example, {@code "/profile"}.
* <p>This is an alias for {@link #path}. For example,
* {@code @RequestMapping("/foo")} is equivalent to
* {@code @RequestMapping(path="/foo")}.
* <p><b>Supported at the type level as well as at the method level!</b>
* When used at the type level, all method-level mappings inherit
* this primary mapping, narrowing it for a specific handler method.
* <p><strong>NOTE</strong>: A handler method that is not mapped to any path
* explicitly is effectively mapped to an empty path.
* {@code @RequestMapping("/profile")} is equivalent to
* {@code @RequestMapping(path="/profile")}.
* <p>See {@link #path} for further details.
*/
@AliasFor("path")
String[] value() default {};

/**
* The path mapping URIs (e.g. {@code "/profile"}).
* The path mapping URIs &mdash; for example, {@code "/profile"}.
* <p>Ant-style path patterns are also supported (e.g. {@code "/profile/**"}).
* At the method level, relative paths (e.g. {@code "edit"}) are supported
* within the primary mapping expressed at the type level.
Expand Down

0 comments on commit 5bf74ca

Please sign in to comment.