diff --git a/src/docs/asciidoc/web/webflux.adoc b/src/docs/asciidoc/web/webflux.adoc index 822ab6478b..e0d97730c9 100644 --- a/src/docs/asciidoc/web/webflux.adoc +++ b/src/docs/asciidoc/web/webflux.adoc @@ -1071,6 +1071,27 @@ supported HTTP methods for example by using the HTTP method specific variants -- is not necessary in the common case. +[[webflux-ann-requestmapping-composed]] +==== Custom Annotations +[.small]#<># + +Spring WebFlux supports the use of <> +for request mapping. Those are annotations that are themselves meta-annotated with +`@RequestMapping` and composed to redeclare a subset (or all) of the `@RequestMapping` +attributes with a narrower, more specific purpose. + +`@GetMapping`, `@PostMapping`, `@PutMapping`, `@DeleteMapping`, and `@PatchMapping` are +examples of composed annotations. They're provided out of the box because arguably most +controller methods should be mapped to a specific HTTP method vs using `@RequestMapping` +which by default matches to all HTTP methods. If you need an example of composed +annotations, 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 +`RequestMappingHandlerMapping` and overriding the `getCustomMethodCondition` method where +you can check the custom attribute and return your own `RequestCondition`. + + [[webflux-ann-methods]] === Handler methods diff --git a/src/docs/asciidoc/web/webmvc.adoc b/src/docs/asciidoc/web/webmvc.adoc index 9aff5be5b8..888d6cf783 100644 --- a/src/docs/asciidoc/web/webmvc.adoc +++ b/src/docs/asciidoc/web/webmvc.adoc @@ -1402,6 +1402,27 @@ supported HTTP methods for example by using the HTTP method specific variants -- is not necessary in the common case. +[[mvc-ann-requestmapping-composed]] +==== Custom Annotations +[.small]#<># + +Spring MVC supports the use of <> +for request mapping. Those are annotations that are themselves meta-annotated with +`@RequestMapping` and composed to redeclare a subset (or all) of the `@RequestMapping` +attributes with a narrower, more specific purpose. + +`@GetMapping`, `@PostMapping`, `@PutMapping`, `@DeleteMapping`, and `@PatchMapping` are +examples of composed annotations. They're provided out of the box because arguably most +controller methods should be mapped to a specific HTTP method vs using `@RequestMapping` +which by default matches to all HTTP methods. If you need an example of composed +annotations, 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 sub-classing +`RequestMappingHandlerMapping` and overriding the `getCustomMethodCondition` method where +you can check the custom attribute and return your own `RequestCondition`. + + [[mvc-ann-methods]] === Handler Methods