In our WebApplication class I want to find all the classes that annotated with @Configuration
. I'm using the below code to do it:
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
scanner.addIncludeFilter(new AnnotationTypeFilter(Configuration.class));
Set<BeanDefinition> configurationBeans = scanner.findCandidateComponents("com.company");
But findCandidateComponents
is not returnnig the classes that annotated with both @Configuration
and @ConditionalOnWebApplication
.
I change the filter to the below, just to test:
scanner.addIncludeFilter(new `AnnotationTypeFilter(ConditionalOnWebApplication.class));`
and I got no classes.
How can it be solved?
Aucun commentaire:
Enregistrer un commentaire