private BindingsGenerator() { provider = new ClassPathScanningCandidateComponentProvider(false) { @Override protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) { AnnotationMetadata metadata = beanDefinition.getMetadata(); return metadata.isIndependent() && !metadata.isInterface(); } }; LOGGER.trace("Scanning for classes with annotations {}", FILTERS); FILTERS.forEach(provider::addIncludeFilter); provider.setResourcePattern("*.class"); }
/** * Create a new instance with the {@code annotationType} to find. * @param annotationType the annotation to find */ public AnnotatedClassFinder(Class<? extends Annotation> annotationType) { Assert.notNull(annotationType, "AnnotationType must not be null"); this.annotationType = annotationType; this.scanner = new ClassPathScanningCandidateComponentProvider(false); this.scanner.addIncludeFilter(new AnnotationTypeFilter(annotationType)); this.scanner.setResourcePattern("*.class"); }
ModulithConfigurationFinder() { this.scanner = new ClassPathScanningCandidateComponentProvider(false); this.scanner.addIncludeFilter(new AnnotationTypeFilter(Modulith.class)); this.scanner.setResourcePattern("*.class"); }
private Set<BeanDefinition> findCandidateBeanDefinitions(ImplementationDetectionConfiguration config) { String postfix = config.getImplementationPostfix(); ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false, environment); provider.setResourceLoader(resourceLoader); provider.setResourcePattern(String.format(CUSTOM_IMPLEMENTATION_RESOURCE_PATTERN, postfix)); provider.setMetadataReaderFactory(config.getMetadataReaderFactory()); provider.addIncludeFilter((reader, factory) -> true); config.getExcludeFilters().forEach(it -> provider.addExcludeFilter(it)); return config.getBasePackages().stream()// .flatMap(it -> provider.findCandidateComponents(it).stream())// .collect(Collectors.toSet()); }