Browse Source

Make @ModelAttribute and @InitBinder reflective

Closes gh-29572
pull/29676/head
Sébastien Deleuze 3 years ago
parent
commit
5ed4a14e2b
  1. 4
      spring-web/src/main/java/org/springframework/web/bind/annotation/InitBinder.java
  2. 3
      spring-web/src/main/java/org/springframework/web/bind/annotation/ModelAttribute.java

4
spring-web/src/main/java/org/springframework/web/bind/annotation/InitBinder.java

@ -22,6 +22,8 @@ import java.lang.annotation.Retention; @@ -22,6 +22,8 @@ import java.lang.annotation.Retention;
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 @@ import java.lang.annotation.Target; @@ -47,6 +49,7 @@ import java.lang.annotation.Target;
* 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 @@ import java.lang.annotation.Target; @@ -55,6 +58,7 @@ import java.lang.annotation.Target;
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Reflective
public @interface InitBinder {
/**

3
spring-web/src/main/java/org/springframework/web/bind/annotation/ModelAttribute.java

@ -22,6 +22,7 @@ import java.lang.annotation.Retention; @@ -22,6 +22,7 @@ import java.lang.annotation.Retention;
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 @@ import org.springframework.ui.Model; @@ -60,12 +61,14 @@ import org.springframework.ui.Model;
*
* @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 {
/**

Loading…
Cancel
Save