-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Description
Oliver Drotbohm opened SPR-9925 and commented
When implementing custom @Enable annotations using ImportBeanDefinitionRegistrar instances, the implementation gets called twice. Chris and I could debug this down into ConfigurationClassParser.findAllAnnotationAttributes(…) where the config class is scanned for annotation attributes. It does an explicit check against meta-annotation attributes (explicitly excluding the annotation type while iterating over the local annotations) and against local annotation attributes right after that.
The crucial issue here is that the local attribute metadata inspected already contains the entire attribute hierarchy. Seems like it has already been resolved against meta annotations at that place. The net effect is that the @Import annotation is found twice - first, through the explicit meta-annotation lookup in my @Enable annotation and second during inspecting the local attributes.
We essentially have to decide to drop the explicit meta-annotation lookup as we seem to be able to find all necessary information through the local scanning already. The other option is to let the attributes only contain local attributes in the first place but this probably has wider implications.
Affects: 3.1.2, 3.2 M2
Sub-tasks:
- Backport fix for multiple invocations of ImportBeanDefinitionRegistrars [SPR-9939] #14572 Backport fix for multiple invocations of ImportBeanDefinitionRegistrars
Issue Links:
- @Enable registrars invoked with subclass for annotation placed on superclass (3.2.x) [SPR-11251] #15876
@Enableregistrars invoked with subclass for annotation placed on superclass (3.2.x) - ConfigurationClassParser needs to load annotations through source class loader [SPR-10343] #14977 ConfigurationClassParser needs to load annotations through source class loader