List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext register
public void register(Class<?>... annotatedClasses)
From source file:org.springframework.integration.configuration.EnableIntegrationTests.java
@Test public void testParentChildAnnotationConfiguration() { AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext(); child.register(ChildConfiguration.class); child.setParent(this.context); child.refresh();/*w w w .ja v a2s. c o m*/ AbstractMessageChannel foo = child.getBean("foo", AbstractMessageChannel.class); ChannelInterceptor baz = child.getBean("baz", ChannelInterceptor.class); assertTrue(foo.getChannelInterceptors().contains(baz)); assertFalse(this.output.getChannelInterceptors().contains(baz)); child.close(); }
From source file:org.springframework.integration.configuration.EnableIntegrationTests.java
@Test public void testParentChildAnnotationConfigurationFromAnotherPackage() { AnnotationConfigApplicationContext child = new AnnotationConfigApplicationContext(); child.register(org.springframework.integration.configuration2.ChildConfiguration.class); child.setParent(this.context); child.refresh();/*from w w w .ja va2 s. c o m*/ AbstractMessageChannel foo = child.getBean("foo", AbstractMessageChannel.class); ChannelInterceptor baz = child.getBean("baz", ChannelInterceptor.class); assertTrue(foo.getChannelInterceptors().contains(baz)); assertFalse(this.output.getChannelInterceptors().contains(baz)); child.close(); }