use of org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver 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.annotation.QualifierAnnotationAutowireCandidateResolver in project spring-framework by spring-projects.
the class ConfigurationClassPostProcessorTests method setup.
@Before
public void setup() {
QualifierAnnotationAutowireCandidateResolver acr = new QualifierAnnotationAutowireCandidateResolver();
acr.setBeanFactory(this.beanFactory);
this.beanFactory.setAutowireCandidateResolver(acr);
}
Aggregations