Polish documentation for @⁠RequestMapping

This commit is contained in:
Sam Brannen 2024-01-17 16:52:10 +01:00
parent 46128cb4b9
commit 5bf74cae11
3 changed files with 15 additions and 19 deletions

View File

@ -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

View File

@ -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

View File

@ -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.
@ -31,7 +31,7 @@ import org.springframework.core.annotation.AliasFor;
*
* <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>
@ -47,16 +47,16 @@ import org.springframework.core.annotation.AliasFor;
* </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
@ -87,21 +87,17 @@ public @interface RequestMapping {
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.