example.scannable.CustomStereotype Java Examples

The following examples show how to use example.scannable.CustomStereotype. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassPathScanningCandidateComponentProviderTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void customSupportIncludeFilterWithNonIndexedTypeUseScan() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
	provider.setResourceLoader(new DefaultResourceLoader(TEST_BASE_CLASSLOADER));
	// This annotation type is not directly annotated with Indexed so we can use
	// the index to find candidates
	provider.addIncludeFilter(new AnnotationTypeFilter(CustomStereotype.class));
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_BASE_PACKAGE);
	assertTrue(containsBeanClass(candidates, DefaultNamedComponent.class));
	assertEquals(1, candidates.size());
	assertBeanDefinitionType(candidates, ScannedGenericBeanDefinition.class);
}
 
Example #2
Source File: ClassPathScanningCandidateComponentProviderTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void customSupportIncludeFilterWithNonIndexedTypeUseScan() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
	provider.setResourceLoader(new DefaultResourceLoader(TEST_BASE_CLASSLOADER));
	// This annotation type is not directly annotated with Indexed so we can use
	// the index to find candidates
	provider.addIncludeFilter(new AnnotationTypeFilter(CustomStereotype.class));
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_BASE_PACKAGE);
	assertTrue(containsBeanClass(candidates, DefaultNamedComponent.class));
	assertEquals(1, candidates.size());
	assertBeanDefinitionType(candidates, ScannedGenericBeanDefinition.class);
}