|
45 | 45 | import org.springframework.beans.factory.support.GenericBeanDefinition;
|
46 | 46 | import org.springframework.beans.factory.support.RootBeanDefinition;
|
47 | 47 | import org.springframework.core.Ordered;
|
| 48 | +import org.springframework.core.ResolvableType; |
48 | 49 | import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
49 | 50 | import org.springframework.core.annotation.Order;
|
50 | 51 | import org.springframework.tests.sample.beans.ITestBean;
|
@@ -1397,6 +1398,8 @@ public void testGenericsBasedFieldInjectionWithSimpleMatch() {
|
1397 | 1398 | assertSame(1, bean.stringRepositoryMap.size());
|
1398 | 1399 | assertSame(repo, bean.repositoryMap.get("repo"));
|
1399 | 1400 | assertSame(repo, bean.stringRepositoryMap.get("repo"));
|
| 1401 | + |
| 1402 | + assertArrayEquals(new String[] {"repo"}, bf.getBeanNamesForType(ResolvableType.forClassWithGenerics(Repository.class, String.class))); |
1400 | 1403 | }
|
1401 | 1404 |
|
1402 | 1405 | @Test
|
@@ -1777,6 +1780,9 @@ public void testGenericsBasedInjectionIntoTypeVariableSelectingBestMatch() {
|
1777 | 1780 | GenericInterface1Impl bean1 = (GenericInterface1Impl) bf.getBean("bean1");
|
1778 | 1781 | GenericInterface2Impl bean2 = (GenericInterface2Impl) bf.getBean("bean2");
|
1779 | 1782 | assertSame(bean2, bean1.gi2);
|
| 1783 | + |
| 1784 | + assertArrayEquals(new String[] {"bean1"}, bf.getBeanNamesForType(ResolvableType.forClassWithGenerics(GenericInterface1.class, String.class))); |
| 1785 | + assertArrayEquals(new String[] {"bean2"}, bf.getBeanNamesForType(ResolvableType.forClassWithGenerics(GenericInterface2.class, String.class))); |
1780 | 1786 | }
|
1781 | 1787 |
|
1782 | 1788 | @Test
|
@@ -2765,7 +2771,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
|
2765 | 2771 |
|
2766 | 2772 | public interface GenericInterface1<T> {
|
2767 | 2773 |
|
2768 |
| - public String doSomethingGeneric(T o); |
| 2774 | + String doSomethingGeneric(T o); |
2769 | 2775 | }
|
2770 | 2776 |
|
2771 | 2777 |
|
|
0 commit comments