Java Code Examples for org.springframework.stereotype.Repository

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project spring-js, under directory /src/test/java/org/springframework/context/annotation/.

Source file: ClassPathScanningCandidateComponentProviderTests.java

  19 
vote

@Test public void testWithComponentAnnotationOnly(){
  ClassPathScanningCandidateComponentProvider provider=new ClassPathScanningCandidateComponentProvider(false);
  provider.addIncludeFilter(new AnnotationTypeFilter(Component.class));
  provider.addExcludeFilter(new AnnotationTypeFilter(Repository.class));
  provider.addExcludeFilter(new AnnotationTypeFilter(Service.class));
  provider.addExcludeFilter(new AnnotationTypeFilter(Controller.class));
  Set<BeanDefinition> candidates=provider.findCandidateComponents(TEST_BASE_PACKAGE);
  assertEquals(2,candidates.size());
  assertTrue(containsBeanClass(candidates,NamedComponent.class));
  assertTrue(containsBeanClass(candidates,ServiceInvocationCounter.class));
  assertFalse(containsBeanClass(candidates,FooServiceImpl.class));
  assertFalse(containsBeanClass(candidates,StubFooDao.class));
  assertFalse(containsBeanClass(candidates,NamedStubDao.class));
}