Fixed hasUnresolvableGenerics() to return false in case of an unresolvable bounded variable as well
Issue: SPR-11250
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user