Fixed hasUnresolvableGenerics() to return false in case of an unresolvable bounded variable as well

Issue: SPR-11250
This commit is contained in:
Juergen Hoeller
2013-12-20 16:44:25 +01:00
parent bc3064cbb7
commit f9e8eb59e1
3 changed files with 96 additions and 34 deletions

View File

@@ -769,6 +769,21 @@ public class BeanFactoryGenericsTests {
assertEquals(1, beans.size());
}
@Test
public void testSpr11250() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.setAutowireCandidateResolver(new GenericTypeAwareAutowireCandidateResolver());
bf.registerBeanDefinition("doubleStore", new RootBeanDefinition(NumberStore.class));
bf.registerBeanDefinition("floatStore", new RootBeanDefinition(NumberStore.class));
bf.registerBeanDefinition("numberBean",
new RootBeanDefinition(NumberBean.class, RootBeanDefinition.AUTOWIRE_CONSTRUCTOR, false));
NumberBean nb = bf.getBean(NumberBean.class);
assertNotNull(nb.getDoubleStore());
assertNotNull(nb.getFloatStore());
}
@SuppressWarnings("serial")
public static class NamedUrlList extends LinkedList<URL> {
@@ -831,4 +846,29 @@ public class BeanFactoryGenericsTests {
}
}
public static class NumberStore<T extends Number> {
}
public static class NumberBean {
private final NumberStore<Double> doubleStore;
private final NumberStore<Float> floatStore;
public NumberBean(NumberStore<Double> doubleStore, NumberStore<Float> floatStore) {
this.doubleStore = doubleStore;
this.floatStore = floatStore;
}
public NumberStore<Double> getDoubleStore() {
return this.doubleStore;
}
public NumberStore<Float> getFloatStore() {
return this.floatStore;
}
}
}