From 2323944a9df753f1fb25e7a2bf5f07c34b6bfaf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Sun, 11 Dec 2022 11:56:22 +0100 Subject: [PATCH] Make @ModelAttribute and @InitBinder reflective Closes gh-29572 --- .../org/springframework/web/bind/annotation/InitBinder.java | 4 ++++ .../springframework/web/bind/annotation/ModelAttribute.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/InitBinder.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/InitBinder.java index 370b2f2801e0..c262653d87af 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/InitBinder.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/InitBinder.java @@ -22,6 +22,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.springframework.aot.hint.annotation.Reflective; + /** * Annotation that identifies methods that initialize the * {@link org.springframework.web.bind.WebDataBinder} which @@ -47,6 +49,7 @@ * or {@link java.util.Locale}, allowing to register context-specific editors. * * @author Juergen Hoeller + * @author Sebastien Deleuze * @since 2.5 * @see ControllerAdvice * @see org.springframework.web.bind.WebDataBinder @@ -55,6 +58,7 @@ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented +@Reflective public @interface InitBinder { /** diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/ModelAttribute.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/ModelAttribute.java index 3316065a0760..fa3893153850 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/ModelAttribute.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/ModelAttribute.java @@ -22,6 +22,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.springframework.aot.hint.annotation.Reflective; import org.springframework.core.annotation.AliasFor; import org.springframework.ui.Model; @@ -60,12 +61,14 @@ * * @author Juergen Hoeller * @author Rossen Stoyanchev + * @author Sebastien Deleuze * @since 2.5 * @see ControllerAdvice */ @Target({ElementType.PARAMETER, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented +@Reflective public @interface ModelAttribute { /**