Package org.springframework.aot.hint.annotation

# Annotation Interface RegisterReflectionForBinding

@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented @RegisterReflection @Reflective(org.springframework.aot.hint.annotation.RegisterReflectionForBindingProcessor.class) public @interface RegisterReflectionForBinding
Register reflection hints for data binding or reflection-based serialization against an arbitrary number of target classes.

For each class hints are registered for constructors, fields, properties, and record components. Hints are also registered for types transitively used on properties and record components.

You can use this annotation on any bean that is contributed to the context:

     @Configuration
     @RegisterReflectionForBinding({Foo.class, Bar.class})
     class MyConfig {
         // ...
     }

If scanning of `Reflective` is enabled, any type in the configured packages can use this annotation as well.

When the annotated element is a type, the type itself is registered if no candidates are provided:

     @Component
     @RegisterReflectionForBinding
     class MyBean {
         // ...
     }

The annotation can also be specified on a method. In that case, at least one target class must be specified:

     @Component
     class MyService {

         @RegisterReflectionForBinding(Baz.class)
         public Baz process() {
             // ...
         }

     }

The annotated element can also be any test class that uses the Spring TestContext Framework to load an `ApplicationContext`.

Since:
  6.0
Author:
  Sebastien Deleuze, Stephane Nicoll
See Also:
  - `BindingReflectionHintsRegistrar`
  - `@RegisterReflection`

## Optional Element Summary

Optional Elements
Modifier and Type
Optional Element
Description
`Class<?>[]`
`classes`
Classes for which reflection hints should be registered.
`String[]`
`classNames`
Alternative to `classes()` to specify the classes as class names.
`Class<?>[]`
`value`
Alias for `classes()`.

## Element Details

### value

@AliasFor(annotation=RegisterReflection.class, attribute="classes") Class<?>[] value
Alias for `classes()`.

Default:
  {}

### classes

@AliasFor(annotation=RegisterReflection.class, attribute="classes") Class<?>[] classes
Classes for which reflection hints should be registered.

At least one class must be specified either via `value()` or `classes`.

See Also:
  - `value()`

Default:
  {}

### classNames

@AliasFor(annotation=RegisterReflection.class, attribute="classNames") String[] classNames
Alternative to `classes()` to specify the classes as class names.

See Also:
  - `classes()`

Default:
  {}