Prior to the update from Spring Boot 2.0.3 to 2.2.4 we had some annotations like the following example:
import org.springframework.stereotype.Component;
@Component
public @interface Adapter {
}
During ComponentScan classes annotated with this Adapter annotation got picked up and added to the Spring context. After the update there are now org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'XY' available
.
According to a passage in the Terminology of the Spring Annotation Programming Model regarding Stereotype Annotations our approach should work:
Any component annotated with @Component is a candidate for component scanning. Similarly, any component annotated with an annotation that is itself meta-annotated with @Component is also a candidate for component scanning.
I read through the release notes of Spring Boot 2.1 and 2.2 and the release notes of the Spring Framework 5.1 and 5.2, but found nothing that the behaviour of stereotype annotations changed in this point.
When I annotate the classes with a Spring provided stereotype annotation (in addition to our own annotation) they get picked up by the ComponentScan.
I also tried to set a custom filter in a @ComponentScan
like this
@ComponentScan(includeFilters = @ComponentScan.Filter(type = FilterType.ANNOTATION,
classes = Adapter.class))
but still got the NoSuchBeanDefinitionException
At last I stumbled upon this "Enhancement" in the Spring Framework and wonder if this could be the root of my problem.
So nothing worked so far and I would be glad if someone could point me in a direction that restores the original behaviour that our own stereotype annotations are working again. Thanks in advance.