|
25 | 25 | import org.springframework.core.annotation.AliasFor;
|
26 | 26 |
|
27 | 27 | /**
|
28 |
| - * Indicates that one or more {@link Class} reflection hints should be registered for |
29 |
| - * data binding purpose (class, fields, properties, record components, including |
30 |
| - * types transitively used on properties and record components). |
| 28 | + * Indicate that the classes specified in the annotation attributes require some |
| 29 | + * reflection hints for binding or reflection-based serialization purpose. For each |
| 30 | + * class specified, hints on constructors, fields, properties, record components, |
| 31 | + * including types transitively used on properties and record components are registered. |
| 32 | + * At least one class must be specified in the {@code value} or {@code classes} annotation |
| 33 | + * attributes. |
31 | 34 | *
|
32 |
| - * <p>Typically used to annotate the bean class or bean method where the reflection hint |
33 |
| - * is needed. |
| 35 | + * <p>Annotated element can be a configuration class, for example: |
| 36 | + * |
| 37 | + * <pre class="code"> |
| 38 | + * @Configuration |
| 39 | + * @RegisterReflectionForBinding({ Foo.class, Bar.class }) |
| 40 | + * public class MyConfig { |
| 41 | + * |
| 42 | + * // ... |
| 43 | + * }</pre> |
| 44 | + * |
| 45 | + * <p>Annotated element can also be any Spring bean class, constructor, field or method, for example: |
| 46 | + * |
| 47 | + * <pre class="code"> |
| 48 | + * @Service |
| 49 | + * public class MyService { |
| 50 | + * |
| 51 | + * @RegisterReflectionForBinding(Baz.class) |
| 52 | + * public void process() { |
| 53 | + * // ... |
| 54 | + * } |
| 55 | + * |
| 56 | + * }</pre> |
34 | 57 | *
|
35 | 58 | * @author Sebastien Deleuze
|
36 | 59 | * @since 6.0
|
| 60 | + * @see org.springframework.aot.hint.BindingReflectionHintsRegistrar |
37 | 61 | */
|
38 | 62 | @Target({ ElementType.TYPE, ElementType.METHOD })
|
39 | 63 | @Retention(RetentionPolicy.RUNTIME)
|
|
42 | 66 | public @interface RegisterReflectionForBinding {
|
43 | 67 |
|
44 | 68 | /**
|
45 |
| - * Classes for which reflection hints should be registered. |
| 69 | + * Classes for which reflection hints should be registered. At least one class must specified |
| 70 | + * either in {@code value} or {@code classes}. |
46 | 71 | * @see #classes()
|
47 | 72 | */
|
48 | 73 | @AliasFor("classes")
|
49 | 74 | Class<?>[] value() default {};
|
50 | 75 |
|
51 | 76 | /**
|
52 |
| - * Classes for which reflection hints should be registered. |
| 77 | + * Classes for which reflection hints should be registered. At least one class must specified |
| 78 | + * either in {@code value} or {@code classes}. |
53 | 79 | * @see #value()
|
54 | 80 | */
|
55 | 81 | @AliasFor("value")
|
|
0 commit comments