org.springframework.context.annotation.componentscan.simple.ClassWithNestedComponents Java Examples

The following examples show how to use org.springframework.context.annotation.componentscan.simple.ClassWithNestedComponents. 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: ComponentScanAnnotationIntegrationTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void viaContextRegistration_WithComposedAnnotation() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.register(ComposedAnnotationConfig.class);
	ctx.refresh();
	ctx.getBean(ComposedAnnotationConfig.class);
	ctx.getBean(SimpleComponent.class);
	ctx.getBean(ClassWithNestedComponents.NestedComponent.class);
	ctx.getBean(ClassWithNestedComponents.OtherNestedComponent.class);
	assertThat("config class bean not found",
			ctx.containsBeanDefinition("componentScanAnnotationIntegrationTests.ComposedAnnotationConfig"), is(true));
	assertThat("@ComponentScan annotated @Configuration class registered directly against " +
					"AnnotationConfigApplicationContext did not trigger component scanning as expected",
			ctx.containsBean("simpleComponent"), is(true));
}
 
Example #2
Source File: ComponentScanAnnotationIntegrationTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void viaContextRegistration_WithComposedAnnotation() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.register(ComposedAnnotationConfig.class);
	ctx.refresh();
	ctx.getBean(ComposedAnnotationConfig.class);
	ctx.getBean(SimpleComponent.class);
	ctx.getBean(ClassWithNestedComponents.NestedComponent.class);
	ctx.getBean(ClassWithNestedComponents.OtherNestedComponent.class);
	assertThat("config class bean not found",
			ctx.containsBeanDefinition("componentScanAnnotationIntegrationTests.ComposedAnnotationConfig"), is(true));
	assertThat("@ComponentScan annotated @Configuration class registered directly against " +
					"AnnotationConfigApplicationContext did not trigger component scanning as expected",
			ctx.containsBean("simpleComponent"), is(true));
}
 
Example #3
Source File: ComponentScanAnnotationIntegrationTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void viaContextRegistration_WithComposedAnnotation() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.register(ComposedAnnotationConfig.class);
	ctx.refresh();
	ctx.getBean(ComposedAnnotationConfig.class);
	ctx.getBean(SimpleComponent.class);
	ctx.getBean(ClassWithNestedComponents.NestedComponent.class);
	ctx.getBean(ClassWithNestedComponents.OtherNestedComponent.class);
	assertThat("config class bean not found",
			ctx.containsBeanDefinition("componentScanAnnotationIntegrationTests.ComposedAnnotationConfig"), is(true));
	assertThat("@ComponentScan annotated @Configuration class registered directly against " +
					"AnnotationConfigApplicationContext did not trigger component scanning as expected",
			ctx.containsBean("simpleComponent"), is(true));
}