Annotation Interface OverrideAnnotationAttributes


@Target(ANNOTATION_TYPE) @Retention(RUNTIME) @Documented @Inherited public @interface OverrideAnnotationAttributes
The meta-annotation that indicates the attributes of the annotation should be overridden.

The annotation must @Import an ImportBeanDefinitionRegistrar or ImportSelector implementation that must extend the abstract class BeanCapableImportCandidate or it subtype.

Example Usage


 // Define a custom annotation with an override strategy
 @OverrideAnnotationAttributes(strategy = MyCustomStrategy.class)
 @Import(MyImportRegistrar.class)
 public @interface MyCustomImport {
     String value() default "";
 }

 // In your ImportSelector or ImportBeanDefinitionRegistrar implementation:
 public class MyImportRegistrar extends BeanCapableImportCandidate implements ImportBeanDefinitionRegistrar {
     public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
          // ...
     }
 }

 // Define an override strategy
 public class MyCustomStrategy implements OverrideAnnotationAttributesStrategy {
     @Override
     public AnnotationAttributes override(AnnotationAttributes originalAttributes, Class<? extends Annotation> annotationType, AnnotationMetadata metadata) {
         // Custom logic to modify attributes
         return originalAttributes;
     }
 }

 @MyCustomImport
 public class AppConfig { }
 
Since:
1.0.0
Author:
Mercy
See Also: