Search in sources :

Example 6 with ConfigurationClassPostProcessor

use of org.springframework.context.annotation.ConfigurationClassPostProcessor in project spring-framework by spring-projects.

the class ImportTests method testImportAnnotationWithMultipleArgumentsResultingInOverriddenBeanDefinition.

@Test
public void testImportAnnotationWithMultipleArgumentsResultingInOverriddenBeanDefinition() {
    DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    beanFactory.registerBeanDefinition("config", new RootBeanDefinition(WithMultipleArgumentsThatWillCauseDuplication.class));
    ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor();
    pp.postProcessBeanFactory(beanFactory);
    assertThat(beanFactory.getBeanDefinitionCount(), equalTo(4));
    assertThat(beanFactory.getBean("foo", ITestBean.class).getName(), equalTo("foo2"));
}
Also used : DefaultListableBeanFactory(org.springframework.beans.factory.support.DefaultListableBeanFactory) RootBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition) ConfigurationClassPostProcessor(org.springframework.context.annotation.ConfigurationClassPostProcessor) Test(org.junit.Test)

Aggregations

DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)6 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)6 ConfigurationClassPostProcessor (org.springframework.context.annotation.ConfigurationClassPostProcessor)6 Test (org.junit.Test)2 RequiredAnnotationBeanPostProcessor (org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor)1 AbstractBeanDefinition (org.springframework.beans.factory.support.AbstractBeanDefinition)1 XmlBeanDefinitionReader (org.springframework.beans.factory.xml.XmlBeanDefinitionReader)1 GenericApplicationContext (org.springframework.context.support.GenericApplicationContext)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 TestBean (org.springframework.tests.sample.beans.TestBean)1