下面列出了怎么用org.springframework.context.annotation.ComponentScanParserTests.KustomAnnotationAutowiredBean的API类实例代码及写法,或者点击链接到github查看源代码。
@Test
public void withCustomTypeFilter() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ComponentScanWithCustomTypeFilter.class);
assertFalse(ctx.getDefaultListableBeanFactory().containsSingleton("componentScanParserTests.KustomAnnotationAutowiredBean"));
KustomAnnotationAutowiredBean testBean = ctx.getBean("componentScanParserTests.KustomAnnotationAutowiredBean", KustomAnnotationAutowiredBean.class);
assertThat(testBean.getDependency(), notNullValue());
}
@Test
public void withCustomTypeFilter() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ComponentScanWithCustomTypeFilter.class);
assertFalse(ctx.getDefaultListableBeanFactory().containsSingleton("componentScanParserTests.KustomAnnotationAutowiredBean"));
KustomAnnotationAutowiredBean testBean = ctx.getBean("componentScanParserTests.KustomAnnotationAutowiredBean", KustomAnnotationAutowiredBean.class);
assertThat(testBean.getDependency(), notNullValue());
}
@Test
public void withCustomTypeFilter() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ComponentScanWithCustomTypeFilter.class);
assertFalse(ctx.getDefaultListableBeanFactory().containsSingleton("componentScanParserTests.KustomAnnotationAutowiredBean"));
KustomAnnotationAutowiredBean testBean = ctx.getBean("componentScanParserTests.KustomAnnotationAutowiredBean", KustomAnnotationAutowiredBean.class);
assertThat(testBean.getDependency(), notNullValue());
}
public ComponentScanParserTests.KustomAnnotationAutowiredBean testBean() {
return new ComponentScanParserTests.KustomAnnotationAutowiredBean();
}
public ComponentScanParserTests.KustomAnnotationAutowiredBean testBean() {
return new ComponentScanParserTests.KustomAnnotationAutowiredBean();
}
public ComponentScanParserTests.KustomAnnotationAutowiredBean testBean() {
return new ComponentScanParserTests.KustomAnnotationAutowiredBean();
}