Allow component name to be specified in @[Rest]ControllerAdvice

This commit builds on the recently added support for using @AliasFor to
override the `value` attribute in `@Component, and allows a custom
component name to be specified in both @ControllerAdvice and
@RestControllerAdvice via new `name` attributes.

See gh-31089
Closes gh-21108
This commit is contained in:
Sam Brannen
2023-08-27 17:38:51 +02:00
parent e239753a1b
commit 4e2d9252e5
7 changed files with 117 additions and 4 deletions

View File

@@ -35,7 +35,9 @@ import java.lang.annotation.Target;
* <p>As of Spring Framework 6.1, custom component stereotype annotations should
* use {@link org.springframework.core.annotation.AliasFor @AliasFor} to declare
* an explicit alias for this annotation's {@link #value} attribute. See the
* source code declaration of {@link Repository#value()} for a concrete example.
* source code declaration of {@link Repository#value()} and
* {@link org.springframework.web.bind.annotation.ControllerAdvice#name()
* ControllerAdvice.name()} for concrete examples.
*
* @author Mark Fisher
* @author Sam Brannen