use of org.springframework.beans.factory.support.BeanDefinitionReader in project spring-framework by spring-projects.
the class QualifierAnnotationTests method testQualifiedByAttributesWithCustomQualifierRegistered.
@Test
public void testQualifiedByAttributesWithCustomQualifierRegistered() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
QualifierAnnotationAutowireCandidateResolver resolver = (QualifierAnnotationAutowireCandidateResolver) context.getDefaultListableBeanFactory().getAutowireCandidateResolver();
resolver.addQualifierType(MultipleAttributeQualifier.class);
context.registerSingleton("testBean", MultiQualifierClient.class);
context.refresh();
MultiQualifierClient testBean = (MultiQualifierClient) context.getBean("testBean");
assertNotNull(testBean.factoryTheta);
assertNotNull(testBean.implTheta);
}
use of org.springframework.beans.factory.support.BeanDefinitionReader in project spring-framework by spring-projects.
the class QualifierAnnotationTests method testQualifiedByCustomValue.
@Test
public void testQualifiedByCustomValue() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
context.registerSingleton("testBean", QualifiedByCustomValueTestBean.class);
context.refresh();
QualifiedByCustomValueTestBean testBean = (QualifiedByCustomValueTestBean) context.getBean("testBean");
Person person = testBean.getCurly();
assertEquals("Curly", person.getName());
}
use of org.springframework.beans.factory.support.BeanDefinitionReader in project spring-framework by spring-projects.
the class QualifierAnnotationTests method testInterfaceWithOneQualifiedFactoryAndOneQualifiedBean.
@Test
public void testInterfaceWithOneQualifiedFactoryAndOneQualifiedBean() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
}
use of org.springframework.beans.factory.support.BeanDefinitionReader in project spring-framework by spring-projects.
the class QualifierAnnotationTests method testQualifiedByFieldName.
@Test
public void testQualifiedByFieldName() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
context.registerSingleton("testBean", QualifiedByFieldNameTestBean.class);
context.refresh();
QualifiedByFieldNameTestBean testBean = (QualifiedByFieldNameTestBean) context.getBean("testBean");
Person person = testBean.getLarry();
assertEquals("LarryBean", person.getName());
}
use of org.springframework.beans.factory.support.BeanDefinitionReader in project spring-framework by spring-projects.
the class QualifierAnnotationTests method testQualifiedByAlias.
@Test
public void testQualifiedByAlias() {
StaticApplicationContext context = new StaticApplicationContext();
BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(CONFIG_LOCATION);
context.registerSingleton("testBean", QualifiedByAliasTestBean.class);
context.refresh();
QualifiedByAliasTestBean testBean = (QualifiedByAliasTestBean) context.getBean("testBean");
Person person = testBean.getStooge();
assertEquals("LarryBean", person.getName());
}
Aggregations