Java Code Examples for org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider

The following are top voted examples for showing how to use org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to product more good examples.

Example 1
Project: spring-data-commons   File: CustomRepositoryImplementationDetector.java View source code 7 votes vote down vote up
/**
 * Tries to detect a custom implementation for a repository bean by classpath scanning.
 * 
 * @param className must not be {@literal null}.
 * @param basePackages must not be {@literal null}.
 * @return the {@code AbstractBeanDefinition} of the custom implementation or {@literal null} if none found
 */
public AbstractBeanDefinition detectCustomImplementation(String className, Iterable<String> basePackages) {

	Assert.notNull(className, "ClassName must not be null!");
	Assert.notNull(basePackages, "BasePackages must not be null!");

	// Build pattern to lookup implementation class
	Pattern pattern = Pattern.compile(".*\\." + className);

	// Build classpath scanner and lookup bean definition
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
	provider.setEnvironment(environment);
	provider.setResourceLoader(resourceLoader);
	provider.setResourcePattern(String.format(CUSTOM_IMPLEMENTATION_RESOURCE_PATTERN, className));
	provider.setMetadataReaderFactory(metadataReaderFactory);
	provider.addIncludeFilter(new RegexPatternTypeFilter(pattern));

	Set<BeanDefinition> definitions = new HashSet<BeanDefinition>();

	for (String basePackage : basePackages) {
		definitions.addAll(provider.findCandidateComponents(basePackage));
	}

	if (definitions.isEmpty()) {
		return null;
	}

	if (definitions.size() == 1) {
		return (AbstractBeanDefinition) definitions.iterator().next();
	}

	List<String> implementationClassNames = new ArrayList<String>();
	for (BeanDefinition bean : definitions) {
		implementationClassNames.add(bean.getBeanClassName());
	}

	throw new IllegalStateException(String.format(
			"Ambiguous custom implementations detected! Found %s but expected a single implementation!",
			StringUtils.collectionToCommaDelimitedString(implementationClassNames)));
}
 
Example 2
Project: spring-data-commons   File: RepositoryConfigurationDelegate.java View source code 7 votes vote down vote up
/**
 * Scans {@code repository.support} packages for implementations of {@link RepositoryFactorySupport}. Finding more
 * than a single type is considered a multi-store configuration scenario which will trigger stricter repository
 * scanning.
 * 
 * @return
 */
private boolean multipleStoresDetected() {

	ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
	scanner.setEnvironment(environment);
	scanner.setResourceLoader(resourceLoader);
	scanner.addIncludeFilter(new LenientAssignableTypeFilter(RepositoryFactorySupport.class));

	if (scanner.findCandidateComponents(MODULE_DETECTION_PACKAGE).size() > 1) {

		LOGGER.debug(MULTIPLE_MODULES);
		return true;
	}

	return false;
}
 
Example 3
Project: beanoh   File: BeanohTestCase.java View source code 6 votes vote down vote up
/**
 * Reconcile the beans marked with org.springframework.stereotype.Component
 * in the classpath with the beans loaded in the Spring context.
 * 
 * Ignore classes with the method ignoreClassNames and ignore packages with
 * the method ignorePackages.
 * 
 * @param basePackage
 *            the base package in which classes annotated with
 *            org.springframework.stereotype.Component will be located
 */
public void assertComponentsInContext(String basePackage) {
	loadContext();
	final Set<String> scannedComponents = new HashSet<String>();
	ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
			true);
	scanner.addIncludeFilter(new AnnotationTypeFilter(Component.class));

	collectComponentsInClasspath(basePackage, scannedComponents, scanner);
	removeComponentsInPackages(scannedComponents);
	removeIgnoredClasses(scannedComponents);

	iterateBeanDefinitions(new BeanDefinitionAction() {
		@Override
		public void execute(String name, BeanDefinition definition) {
			scannedComponents.remove(definition.getBeanClassName());
		}
	});

	if (scannedComponents.size() > 0) {
		throw new MissingComponentException(
				"There are beans marked with '@Component' in the classpath that are not configured by Spring. "
						+ "Either configure these beans or ignore them with the 'ignoreClassNames' or 'ignorePackages' method.\n"
						+ "Components not in Spring:"
						+ missingList(scannedComponents));
	}
}
 
Example 4
Project: alien4cloud   File: TypeScanner.java View source code 6 votes vote down vote up
public static Set<Class<?>> scanTypes(String basePackage, Class<?> targetType) throws ClassNotFoundException {
    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);

    AssignableTypeFilter filter = new AssignableTypeFilter(targetType);
    scanner.addIncludeFilter(filter);
    Set<BeanDefinition> beanSet = scanner.findCandidateComponents(basePackage);

    Set<Class<?>> classSet = new HashSet<Class<?>>();
    for (BeanDefinition beanDef : beanSet) {
        log.debug("found candidate bean = {}", beanDef.getBeanClassName());

        Class<?> clazz;

        clazz = Class.forName(beanDef.getBeanClassName(), true, Thread.currentThread().getContextClassLoader());
        classSet.add(clazz);
    }

    return classSet;
}
 
Example 5
Project: usergrid   File: Schema.java View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void scanEntities() {
    synchronized ( entitiesScanPath ) {
        for ( String path : entitiesScanPath ) {
            ClassPathScanningCandidateComponentProvider provider =
                    new ClassPathScanningCandidateComponentProvider( true );
            provider.addIncludeFilter( new AssignableTypeFilter( TypedEntity.class ) );

            Set<BeanDefinition> components = provider.findCandidateComponents( path );
            for ( BeanDefinition component : components ) {
                try {
                    Class<?> cls = Class.forName( component.getBeanClassName() );
                    if ( Entity.class.isAssignableFrom( cls ) ) {
                        registerEntity( ( Class<? extends Entity> ) cls );
                    }
                }
                catch ( ClassNotFoundException e ) {
                    logger.error( "Unable to get entity class ", e );
                }
            }
            registerEntity( DynamicEntity.class );
        }
    }
}
 
Example 6
Project: c24-spring   File: C24ModelBeanDefinitionParser.java View source code 6 votes vote down vote up
/**
 * Classpath scans the given base package for subclasses of {@link biz.c24.io.api.data.Element} whose names end on
 * {@code DocumentRootElement}.
 * 
 * @param basePackage
 * @param context
 * @param source
 * @return
 */
private AbstractBeanDefinition getC24ModelFromPackage(String basePackage, ParserContext context, Object source) {

	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
	provider.addIncludeFilter(new TypeFilter() {

		private final TypeFilter nameFilter = new RegexPatternTypeFilter(Pattern.compile(".*DocumentRootElement"));
		private final TypeFilter typeFilter = new AssignableTypeFilter(biz.c24.io.api.data.Element.class);

		public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory)
				throws IOException {
			return nameFilter.match(metadataReader, metadataReaderFactory)
					&& typeFilter.match(metadataReader, metadataReaderFactory);
		}
	});

	Set<BeanDefinition> result = provider.findCandidateComponents(basePackage);
	if (result.size() != 1) {
		context.getReaderContext().error("Found none or multiple classes ending on 'DocumentRootElement'!", source);
	}

	String elementClassName = result.iterator().next().getBeanClassName();
	return getC24ModelFromElement(elementClassName, context, source);
}
 
Example 7
Project: DataCleaner   File: SwaggerJSONController.java View source code 6 votes vote down vote up
private Set<Class<?>> getControllerClasses() {
    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
    scanner.addIncludeFilter(new AnnotationTypeFilter(Controller.class));
    Set<Class<?>> controllerClasses = new HashSet<>();

    for (BeanDefinition beanDefinition :
            scanner.findCandidateComponents(SwaggerJSONController.CONTROLLERS_PACKAGE)) {
        try {
            String className = beanDefinition.getBeanClassName();
            controllerClasses.add(Class.forName(className));
        }
        catch (ClassNotFoundException e) {
            continue;
        }
    }

    return controllerClasses;
}
 
Example 8
Project: spring-cloud-netflix   File: EurekaServerConfiguration.java View source code 6 votes vote down vote up
/**
 * Construct a Jersey {@link javax.ws.rs.core.Application} with all the resources
 * required by the Eureka server.
 */
@Bean
public javax.ws.rs.core.Application jerseyApplication(Environment environment,
		ResourceLoader resourceLoader) {

	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(
			false, environment);

	// Filter to include only classes that have a particular annotation.
	//
	provider.addIncludeFilter(new AnnotationTypeFilter(Path.class));
	provider.addIncludeFilter(new AnnotationTypeFilter(Provider.class));

	// Find classes in Eureka packages (or subpackages)
	//
	Set<Class<?>> classes = new HashSet<Class<?>>();
	for (String basePackage : EUREKA_PACKAGES) {
		Set<BeanDefinition> beans = provider.findCandidateComponents(basePackage);
		for (BeanDefinition bd : beans) {
			Class<?> cls = ClassUtils.resolveClassName(bd.getBeanClassName(),
					resourceLoader.getClassLoader());
			classes.add(cls);
		}
	}

	// Construct the Jersey ResourceConfig
	//
	Map<String, Object> propsAndFeatures = new HashMap<String, Object>();
	propsAndFeatures.put(
			// Skip static content used by the webapp
			ServletContainer.PROPERTY_WEB_PAGE_CONTENT_REGEX,
			EurekaServerConfigBean.DEFAULT_PREFIX + "/(fonts|images|css|js)/.*");

	DefaultResourceConfig rc = new DefaultResourceConfig(classes);
	rc.setPropertiesAndFeatures(propsAndFeatures);

	return rc;
}
 
Example 9
Project: oryx-engine   File: JodaEngineApplication.java View source code 6 votes vote down vote up
/**
 * Returns a list of {@link ExceptionMapper}s.
 * 
 * @return exception mappers
 */
@SuppressWarnings("unchecked")
private Set<Class<? extends ExceptionMapper<?>>> getExceptionMappers() {
    
    Set<Class<? extends ExceptionMapper<?>>> mappers = new HashSet<Class<? extends ExceptionMapper<?>>>();
    
    //
    // Rather than adding those manually we scan all classes for the provider annotation
    // http://stackoverflow.com/questions/259140/scanning-java-annotations-at-runtime
    //
    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
    
    scanner.addIncludeFilter(new AnnotationTypeFilter(javax.ws.rs.ext.Provider.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(ExceptionMapper.class));
    
    for (BeanDefinition bd : scanner.findCandidateComponents(JodaEngine.BASE_PACKAGE)) {
        try {
            mappers.add((Class<ExceptionMapper<?>>) Class.forName(bd.getBeanClassName()));
        } catch (ClassNotFoundException e) {
            logger.warn("An ExceptionMapper could not be loaded from the class path.", e);
        }
    }
    
    return mappers;
}
 
Example 10
Project: dd4t-2-java   File: BaseDataBinder.java View source code 6 votes vote down vote up
protected void scanAndLoadModels () {
	LOG.info("Init: scanning view models.");
	final ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
	scanner.addIncludeFilter(new AnnotationTypeFilter(ViewModel.class));
	for (BeanDefinition bd : scanner.findCandidateComponents(this.viewModelPackageRoot)) {
		try {
			final Class clazz = Class.forName(bd.getBeanClassName());
			if (clazz != null) {
				LOG.debug("Loading class: " + clazz.getCanonicalName());
				final ViewModel viewModelParameters = (ViewModel) clazz.getAnnotation(ViewModel.class);

				if (hasProperModelInformation(viewModelParameters,clazz)) {
					LOG.debug("Parameters: Viewmodel name(s):{}, Root Element name(s){}, Set Component: {}, Set raw: {} ", new Object[]{viewModelParameters.viewModelNames(), viewModelParameters.rootElementNames(), viewModelParameters.setComponentObject(), viewModelParameters.setRawData()});
					storeModelClass(viewModelParameters, clazz);
				}
			}
			LOG.info("Init: Done scanning view models.");
		} catch (ClassNotFoundException e) {
			LOG.error("Unexpected exception", e);
		}
	}
}
 
Example 11
Project: metacoder-blog   File: SchemaExporter.java View source code 6 votes vote down vote up
protected static Collection<Class<?>> getEntitiesFromPackage(String packageName) {
	Collection<Class<?>> foundEntities = new ArrayList<Class<?>>();
	ClassPathScanningCandidateComponentProvider pathScanner = new ClassPathScanningCandidateComponentProvider(false);
	pathScanner.addIncludeFilter(new AnnotationTypeFilter(Entity.class));
	for(BeanDefinition beanDefinition : pathScanner.findCandidateComponents(packageName)){
		try {
			foundEntities.add(Class.forName(beanDefinition.getBeanClassName()));
		} catch (ClassNotFoundException e) { 
			// shoud never happen here so wrap it in a runtime exception to avoid poisoning the methods signature here
			throw new RuntimeException(e);
		}
	}
	return foundEntities;
}
 
Example 12
Project: JodaEngine   File: JodaEngineApplication.java View source code 6 votes vote down vote up
/**
 * Returns a list of {@link ExceptionMapper}s.
 * 
 * @return exception mappers
 */
@SuppressWarnings("unchecked")
private Set<Class<? extends ExceptionMapper<?>>> getExceptionMappers() {
    
    Set<Class<? extends ExceptionMapper<?>>> mappers = new HashSet<Class<? extends ExceptionMapper<?>>>();
    
    //
    // Rather than adding those manually we scan all classes for the provider annotation
    // http://stackoverflow.com/questions/259140/scanning-java-annotations-at-runtime
    //
    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
    
    scanner.addIncludeFilter(new AnnotationTypeFilter(javax.ws.rs.ext.Provider.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(ExceptionMapper.class));
    
    for (BeanDefinition bd : scanner.findCandidateComponents(JodaEngine.BASE_PACKAGE)) {
        try {
            mappers.add((Class<ExceptionMapper<?>>) Class.forName(bd.getBeanClassName()));
        } catch (ClassNotFoundException e) {
            logger.warn("An ExceptionMapper could not be loaded from the class path.", e);
        }
    }
    
    return mappers;
}
 
Example 13
Project: jOOQ   File: JPADatabase.java View source code 6 votes vote down vote up
@Override
protected DSLContext create0() {
    if (connection == null) {
        String packages = getProperties().getProperty("packages");

        if (isBlank(packages)) {
            packages = "";
            log.warn("No packages defined", "It is highly recommended that you provide explicit packages to scan");
        }

        try {
            connection = DriverManager.getConnection("jdbc:h2:mem:jooq-meta-extensions", "sa", "");

            MetadataSources metadata = new MetadataSources(
                new StandardServiceRegistryBuilder()
                    .applySetting("hibernate.dialect", "org.hibernate.dialect.H2Dialect")
                    .build()
            );

            ClassPathScanningCandidateComponentProvider scanner =
                new ClassPathScanningCandidateComponentProvider(true);

            scanner.addIncludeFilter(new AnnotationTypeFilter(Entity.class));
            for (String pkg : packages.split(",")) {
                for (BeanDefinition def : scanner.findCandidateComponents(defaultIfBlank(pkg, "").trim())) {
                    metadata.addAnnotatedClass(Class.forName(def.getBeanClassName()));
                }
            }

            // This seems to be the way to do this in idiomatic Hibernate 5.0 API
            // See also: http://stackoverflow.com/q/32178041/521799
            SchemaExport export = new SchemaExport((MetadataImplementor) metadata.buildMetadata(), connection);
            export.create(true, true);
        }
        catch (Exception e) {
            throw new DataAccessException("Error while exporting schema", e);
        }
    }

    return DSL.using(connection);
}
 
Example 14
Project: hades   File: DaoConfigDefinitionParser.java View source code 6 votes vote down vote up
/**
 * Tries to detect a custom implementation for a DAO bean by classpath
 * scanning.
 * 
 * @param context
 * @param parser
 * @return the {@code BeanDefinition} of the custom implementation or null
 *         if none found
 */
private AbstractBeanDefinition detectCustomImplementation(
        final DaoContext context, final ParserContext parser) {

    // Build pattern to lookup implementation class
    Pattern pattern =
            Pattern.compile(".*" + context.getImplementationClassName());

    // Build classpath scanner and lookup bean definition
    ClassPathScanningCandidateComponentProvider provider =
            new ClassPathScanningCandidateComponentProvider(false);
    provider.setResourceLoader(parser.getReaderContext()
            .getResourceLoader());
    provider.addIncludeFilter(new RegexPatternTypeFilter(pattern));
    Set<BeanDefinition> definitions =
            provider.findCandidateComponents(context
                    .getDaoBasePackageName());

    return (0 == definitions.size() ? null
            : (AbstractBeanDefinition) definitions.iterator().next());
}
 
Example 15
Project: beanoh   File: BeanohTestCase.java View source code 6 votes vote down vote up
private void collectComponentsInClasspath(String basePackage,
		final Set<String> scannedComponents,
		ClassPathScanningCandidateComponentProvider scanner) {
	for (BeanDefinition beanDefinition : scanner
			.findCandidateComponents(basePackage)) {
		scannedComponents.add(beanDefinition.getBeanClassName());
	}
}
 
Example 16
Project: spring-data-gemfire   File: AbstractFunctionExecutionConfigurationSource.java View source code 6 votes vote down vote up
public Collection<ScannedGenericBeanDefinition> getCandidates(ResourceLoader loader) {
	ClassPathScanningCandidateComponentProvider scanner = new FunctionExecutionComponentProvider(
		getIncludeFilters(), getFunctionExecutionAnnotationTypes());

	scanner.setResourceLoader(loader);

	for (TypeFilter filter : getExcludeFilters()) {
		scanner.addExcludeFilter(filter);
	}

	Set<ScannedGenericBeanDefinition> result = new HashSet<ScannedGenericBeanDefinition>();

	for (String basePackage : getBasePackages()) {
		if (logger.isDebugEnabled()) {
			logger.debug("scanning package " + basePackage);
		}

		Collection<BeanDefinition> candidateComponents = scanner.findCandidateComponents(basePackage);

		for (BeanDefinition beanDefinition : candidateComponents) {
			result.add((ScannedGenericBeanDefinition) beanDefinition);
		}
	}

	return result;
}
 
Example 17
Project: spring-data-commons   File: AnnotatedTypeScanner.java View source code 6 votes vote down vote up
public Set<Class<?>> findTypes(Iterable<String> basePackages) {

		ClassPathScanningCandidateComponentProvider provider = new InterfaceAwareScanner(considerInterfaces);

		if (resourceLoader != null) {
			provider.setResourceLoader(resourceLoader);
		}

		if (environment != null) {
			provider.setEnvironment(environment);
		}

		for (Class<? extends Annotation> annotationType : annotationTypess) {
			provider.addIncludeFilter(new AnnotationTypeFilter(annotationType, true, considerInterfaces));
		}

		Set<Class<?>> types = new HashSet<Class<?>>();

		for (String basePackage : basePackages) {

			for (BeanDefinition definition : provider.findCandidateComponents(basePackage)) {
				try {
					types.add(ClassUtils.forName(definition.getBeanClassName(),
							resourceLoader == null ? null : resourceLoader.getClassLoader()));
				} catch (ClassNotFoundException o_O) {
					throw new IllegalStateException(o_O);
				}
			}
		}

		return types;
	}
 
Example 18
Project: spring-xd   File: AbstractComponentScanningBeanDefinitionProvider.java View source code 6 votes vote down vote up
@Override
public void onApplicationEvent(ApplicationPreparedEvent event) {
	if (StringUtils.hasText(getExtensionsBasePackages())) {
		AnnotationConfigApplicationContext context = (AnnotationConfigApplicationContext) event.getApplicationContext();
		ClassPathScanningCandidateComponentProvider componentProvider = new
				ClassPathScanningCandidateComponentProvider(
						true, context.getEnvironment());

		for (String basePackage : StringUtils.commaDelimitedListToStringArray(getExtensionsBasePackages())) {
			for (BeanDefinition bean : componentProvider.findCandidateComponents(basePackage)) {
				context.registerBeanDefinition(BeanDefinitionReaderUtils.generateBeanName(bean, context), bean);
			}
		}
	}
}
 
Example 19
Project: hades   File: DaoConfigDefinitionParser.java View source code 6 votes vote down vote up
private Set<String> getDaoInterfacesForAutoConfig(
        final DaoConfigContext configContext, final ResourceLoader loader,
        final ReaderContext readerContext) {

    ClassPathScanningCandidateComponentProvider scanner =
            new GenericDaoComponentProvider();
    scanner.setResourceLoader(loader);

    TypeFilterParser parser =
            new TypeFilterParser(loader.getClassLoader(), readerContext);
    parser.parseFilters(configContext.getElement(), scanner);

    Set<BeanDefinition> findCandidateComponents =
            scanner.findCandidateComponents(configContext
                    .getDaoBasePackageName());

    Set<String> interfaceNames = new HashSet<String>();
    for (BeanDefinition definition : findCandidateComponents) {
        interfaceNames.add(definition.getBeanClassName());
    }

    return interfaceNames;
}
 
Example 20
Project: spring-boot   File: MongoDataAutoConfiguration.java View source code 6 votes vote down vote up
private Set<Class<?>> getInitialEntitySet(BeanFactory beanFactory)
		throws ClassNotFoundException {
	Set<Class<?>> entitySet = new HashSet<Class<?>>();
	ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
			false);
	scanner.setEnvironment(this.environment);
	scanner.setResourceLoader(this.resourceLoader);
	scanner.addIncludeFilter(new AnnotationTypeFilter(Document.class));
	scanner.addIncludeFilter(new AnnotationTypeFilter(Persistent.class));
	for (String basePackage : getMappingBasePackages(beanFactory)) {
		if (StringUtils.hasText(basePackage)) {
			for (BeanDefinition candidate : scanner
					.findCandidateComponents(basePackage)) {
				entitySet.add(ClassUtils.forName(candidate.getBeanClassName(),
						this.classLoader));
			}
		}
	}
	return entitySet;
}
 
Example 21
Project: elpaaso-core   File: PluginConfigurationIT.java View source code 5 votes vote down vote up
@Test
public void should_not_found_any_dependant_model_item_without_active_plugin_in_production() throws Exception {
    String datacenter = System.getProperty("datacenter", "hudson");
    initJndiValues("com/francetelecom/clara/cloud/commons/testconfigurations/credentials-" + datacenter + ".properties");

    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{
            "classpath:/spring-config/application-context-plugins.xml",
            "classpath:/spring-config/datasources-hsqldb-context.xml",
            "classpath:/com/francetelecom/clara/cloud/commons/testconfigurations/mock-liquibase-context.xml",
            "classpath:/META-INF/spring/paas-activation-stubbed-context.xml", "classpath:/spring-config/mock-spring-authentication-manager-context.xml"}) {
        @Override
        protected ConfigurableEnvironment createEnvironment() {
            return new StandardServletEnvironment();
        }
    };

    ActivationPluginStrategy strategy = (ActivationPluginStrategy) context.getBean("pluginStrategy");

    ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
    provider.addIncludeFilter(new AssignableTypeFilter(DependantModelItem.class));

    Set<BeanDefinition> findCandidateComponents = provider.findCandidateComponents("com/francetelecom/clara/cloud/model");
    ActivationStepEnum[] steps = ActivationStepEnum.values();

    Set<Class<?>> errorItems = new HashSet<Class<?>>();

    for (BeanDefinition beanDefinition : findCandidateComponents) {
        ActivationPlugin foundPlugin = null;
        Class<?> testedClass = Class.forName(beanDefinition.getBeanClassName());
        LOGGER.info("Lookin for a plugin handling {}", testedClass.getSimpleName());
        for (ActivationStepEnum activationStepEnum : steps) {
            if (foundPlugin == null) {
                try {
                    foundPlugin = strategy.getPlugin(testedClass, activationStepEnum);
                } catch (TechnicalException e) {
                    //Ignore not found error
                }
            }
        }

        if (foundPlugin == null) {
            if (ignoredClasses.contains(testedClass)) {
                LOGGER.info("No plugin found for {} but ignored !", testedClass.getSimpleName());
            } else {
                LOGGER.info("No plugin found for {}", testedClass.getSimpleName());
            }
            errorItems.add(testedClass);
        } else {
            assertFalse(testedClass.getSimpleName() + " is ignored but a plugin has been found : " + foundPlugin.getClass().getSimpleName() + ".\nDid you activate new feature without refactoring this test specs ?", ignoredClasses.contains(testedClass));
            LOGGER.info("Plugin found for {} : {}", testedClass.getSimpleName(), foundPlugin.getClass().getSimpleName());
        }
    }

    errorItems.removeAll(ignoredClasses);

    assertTrue("No plugin found for some items " + errorItems.toString() + ".\nDid you miss some configuration in cloud-paas-webapp spring config?", errorItems.isEmpty());
}