类org.springframework.context.annotation2.NamedStubDao2源码实例Demo

下面列出了怎么用org.springframework.context.annotation2.NamedStubDao2的API类实例代码及写法,或者点击链接到github查看源代码。

@Test
public void testSimpleScanWithDefaultFiltersAndSpecifiedBeanNameClash() {
	GenericApplicationContext context = new GenericApplicationContext();
	ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
	scanner.setIncludeAnnotationConfig(false);
	try {
		scanner.scan("org.springframework.context.annotation2");
		scanner.scan(BASE_PACKAGE);
		fail("Must have thrown IllegalStateException");
	}
	catch (IllegalStateException expected) {
		assertTrue(expected.getMessage().contains("myNamedDao"));
		assertTrue(expected.getMessage().contains(NamedStubDao.class.getName()));
		assertTrue(expected.getMessage().contains(NamedStubDao2.class.getName()));
	}
}
 
@Test
public void testSimpleScanWithDefaultFiltersAndSpecifiedBeanNameClash() {
	GenericApplicationContext context = new GenericApplicationContext();
	ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
	scanner.setIncludeAnnotationConfig(false);
	try {
		scanner.scan("org.springframework.context.annotation2");
		scanner.scan(BASE_PACKAGE);
		fail("Must have thrown IllegalStateException");
	}
	catch (IllegalStateException expected) {
		assertTrue(expected.getMessage().contains("myNamedDao"));
		assertTrue(expected.getMessage().contains(NamedStubDao.class.getName()));
		assertTrue(expected.getMessage().contains(NamedStubDao2.class.getName()));
	}
}
 
@Test
public void testSimpleScanWithDefaultFiltersAndSpecifiedBeanNameClash() {
	GenericApplicationContext context = new GenericApplicationContext();
	ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
	scanner.setIncludeAnnotationConfig(false);
	try {
		scanner.scan("org.springframework.context.annotation2");
		scanner.scan(BASE_PACKAGE);
		fail("Must have thrown IllegalStateException");
	}
	catch (IllegalStateException expected) {
		assertTrue(expected.getMessage().contains("myNamedDao"));
		assertTrue(expected.getMessage().contains(NamedStubDao.class.getName()));
		assertTrue(expected.getMessage().contains(NamedStubDao2.class.getName()));
	}
}
 
 同包方法