ResolvableType-based matching respects generic factory method return type

Includes consistent use of ResolvableType.resolve() wherever applicable.

Issue: SPR-15011
(cherry picked from commit 4c005e6)
This commit is contained in:
Juergen Hoeller
2016-12-17 23:10:48 +01:00
parent faab4f9e28
commit b9c4f1fa95
14 changed files with 145 additions and 53 deletions

View File

@@ -1295,7 +1295,6 @@ public class AutowiredAnnotationBeanPostProcessorTests {
}
catch (UnsatisfiedDependencyException ex) {
// expected
ex.printStackTrace();
assertSame(CustomAnnotationRequiredFieldResourceInjectionBean.class,
ex.getInjectionPoint().getField().getDeclaringClass());
}
@@ -1681,9 +1680,6 @@ public class AutowiredAnnotationBeanPostProcessorTests {
assertSame(ir, bean.integerRepositoryMap.get("integerRepository"));
}
@Qualifier("integerRepo")
private Repository<?> integerRepositoryQualifierProvider;
@Test
public void testGenericsBasedFieldInjectionWithSimpleMatch() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
@@ -2184,6 +2180,19 @@ public class AutowiredAnnotationBeanPostProcessorTests {
assertNotNull(bf.getBean(ProvidedArgumentBean.class));
}
@Test
public void testAnnotatedDefaultConstructor() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.addBeanPostProcessor(new AutowiredAnnotationBeanPostProcessor());
bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(AnnotatedDefaultConstructorBean.class));
assertNotNull(bf.getBean("annotatedBean"));
}
@Qualifier("integerRepo")
private Repository<?> integerRepositoryQualifierProvider;
public static class ResourceInjectionBean {
@@ -3411,7 +3420,14 @@ public class AutowiredAnnotationBeanPostProcessorTests {
tbs.add(new TestBean("tb2"));
return tbs;
}
}
public static class AnnotatedDefaultConstructorBean {
@Autowired
public AnnotatedDefaultConstructorBean() {
}
}
}