@ -1614,6 +1614,10 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -1614,6 +1614,10 @@ class AutowiredAnnotationBeanPostProcessorTests {
assertThat ( testBeans ) . containsExactly ( bf . getBean ( "testBean1" , TestBean . class ) , bf . getBean ( "testBean2" , TestBean . class ) ) ;
testBeans = bean . allTestBeansInOrder ( ) ;
assertThat ( testBeans ) . containsExactly ( bf . getBean ( "testBean1" , TestBean . class ) , bf . getBean ( "testBean2" , TestBean . class ) ) ;
testBeans = bean . allSingletonBeans ( ) ;
assertThat ( testBeans ) . isEmpty ( ) ;
testBeans = bean . allSingletonBeansInOrder ( ) ;
assertThat ( testBeans ) . isEmpty ( ) ;
}
@Test
@ -1648,6 +1652,12 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -1648,6 +1652,12 @@ class AutowiredAnnotationBeanPostProcessorTests {
testBeans = bean . allTestBeansInOrder ( ) ;
assertThat ( testBeans ) . hasSize ( 1 ) ;
assertThat ( testBeans ) . contains ( bf . getBean ( "testBean" , TestBean . class ) ) ;
testBeans = bean . allSingletonBeans ( ) ;
assertThat ( testBeans ) . hasSize ( 1 ) ;
assertThat ( testBeans ) . contains ( bf . getBean ( "testBean" , TestBean . class ) ) ;
testBeans = bean . allSingletonBeansInOrder ( ) ;
assertThat ( testBeans ) . hasSize ( 1 ) ;
assertThat ( testBeans ) . contains ( bf . getBean ( "testBean" , TestBean . class ) ) ;
}
@Test
@ -1675,6 +1685,10 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -1675,6 +1685,10 @@ class AutowiredAnnotationBeanPostProcessorTests {
assertThat ( testBeans ) . isEmpty ( ) ;
testBeans = bean . allTestBeansInOrder ( ) ;
assertThat ( testBeans ) . isEmpty ( ) ;
testBeans = bean . allSingletonBeans ( ) ;
assertThat ( testBeans ) . isEmpty ( ) ;
testBeans = bean . allSingletonBeansInOrder ( ) ;
assertThat ( testBeans ) . isEmpty ( ) ;
}
@Test
@ -1698,6 +1712,8 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -1698,6 +1712,8 @@ class AutowiredAnnotationBeanPostProcessorTests {
assertThat ( bean . streamTestBeansInOrder ( ) ) . containsExactly ( testBean1 , testBean2 ) ;
assertThat ( bean . allTestBeans ( ) ) . containsExactly ( testBean1 , testBean2 ) ;
assertThat ( bean . allTestBeansInOrder ( ) ) . containsExactly ( testBean1 , testBean2 ) ;
assertThat ( bean . allSingletonBeans ( ) ) . containsExactly ( testBean1 , testBean2 ) ;
assertThat ( bean . allSingletonBeansInOrder ( ) ) . containsExactly ( testBean1 , testBean2 ) ;
}
@Test
@ -1728,6 +1744,8 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -1728,6 +1744,8 @@ class AutowiredAnnotationBeanPostProcessorTests {
assertThat ( bean . streamTestBeansInOrder ( ) ) . containsExactly ( testBean2 , testBean1 ) ;
assertThat ( bean . allTestBeans ( ) ) . containsExactly ( testBean1 , testBean2 ) ;
assertThat ( bean . allTestBeansInOrder ( ) ) . containsExactly ( testBean2 , testBean1 ) ;
assertThat ( bean . allSingletonBeans ( ) ) . containsExactly ( testBean1 , testBean2 ) ;
assertThat ( bean . allSingletonBeansInOrder ( ) ) . containsExactly ( testBean2 , testBean1 ) ;
}
@Test
@ -1739,7 +1757,7 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -1739,7 +1757,7 @@ class AutowiredAnnotationBeanPostProcessorTests {
bf . registerBeanDefinition ( "testBean1" , tb1 ) ;
RootBeanDefinition tb2 = new RootBeanDefinition ( TestBeanFactory . class ) ;
tb2 . setFactoryMethodName ( "newTestBean2" ) ;
tb2 . setLazyInit ( true ) ;
tb2 . setScope ( BeanDefinition . SCOPE_PROTOTYPE ) ;
bf . registerBeanDefinition ( "testBean2" , tb2 ) ;
ObjectProviderInjectionBean bean = bf . getBean ( "annotatedBean" , ObjectProviderInjectionBean . class ) ;
@ -1747,6 +1765,7 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -1747,6 +1765,7 @@ class AutowiredAnnotationBeanPostProcessorTests {
bf . getBean ( "testBean1" , TestBean . class ) ) ;
assertThat ( bean . allTestBeansInOrder ( ) ) . containsExactly ( bf . getBean ( "testBean2" , TestBean . class ) ,
bf . getBean ( "testBean1" , TestBean . class ) ) ;
assertThat ( bean . allSingletonBeansInOrder ( ) ) . containsExactly ( bf . getBean ( "testBean1" , TestBean . class ) ) ;
}
@Test
@ -1757,6 +1776,7 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -1757,6 +1776,7 @@ class AutowiredAnnotationBeanPostProcessorTests {
bf . registerBeanDefinition ( "testBean1" , tb1 ) ;
RootBeanDefinition tb2 = new RootBeanDefinition ( TestBeanFactory . class ) ;
tb2 . setFactoryMethodName ( "newTestBean2" ) ;
tb2 . setScope ( BeanDefinition . SCOPE_PROTOTYPE ) ;
bf . registerBeanDefinition ( "testBean2" , tb2 ) ;
DefaultListableBeanFactory parent = new DefaultListableBeanFactory ( ) ;
@ -1789,6 +1809,10 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -1789,6 +1809,10 @@ class AutowiredAnnotationBeanPostProcessorTests {
bf . getBean ( "testBean2" , TestBean . class ) , bf . getBean ( "testBean4" , TestBean . class ) ) ;
assertThat ( bean . allTestBeansInOrder ( ) ) . containsExactly ( bf . getBean ( "testBean2" , TestBean . class ) ,
bf . getBean ( "testBean1" , TestBean . class ) , bf . getBean ( "testBean4" , TestBean . class ) ) ;
assertThat ( bean . allSingletonBeans ( ) ) . containsExactly ( bf . getBean ( "testBean1" , TestBean . class ) ,
bf . getBean ( "testBean4" , TestBean . class ) ) ;
assertThat ( bean . allSingletonBeansInOrder ( ) ) . containsExactly ( bf . getBean ( "testBean1" , TestBean . class ) ,
bf . getBean ( "testBean4" , TestBean . class ) ) ;
Map < String , TestBean > typeMatches = BeanFactoryUtils . beansOfTypeIncludingAncestors ( bf , TestBean . class ) ;
assertThat ( typeMatches . remove ( "testBean3" ) ) . isNotNull ( ) ;
@ -2370,7 +2394,7 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -2370,7 +2394,7 @@ class AutowiredAnnotationBeanPostProcessorTests {
}
@Test
@SuppressWarnings ( { "rawtypes" , "unchecked" } )
@SuppressWarnings ( "unchecked" )
void genericsBasedConstructorInjectionWithNonTypedTarget ( ) {
RootBeanDefinition bd = new RootBeanDefinition ( RepositoryConstructorInjectionBean . class ) ;
bd . setScope ( BeanDefinition . SCOPE_PROTOTYPE ) ;
@ -3393,6 +3417,14 @@ class AutowiredAnnotationBeanPostProcessorTests {
@@ -3393,6 +3417,14 @@ class AutowiredAnnotationBeanPostProcessorTests {
public List < TestBean > allTestBeansInOrder ( ) {
return this . testBean . orderedStream ( ObjectProvider . UNFILTERED ) . toList ( ) ;
}
public List < TestBean > allSingletonBeans ( ) {
return this . testBean . stream ( ObjectProvider . UNFILTERED , false ) . toList ( ) ;
}
public List < TestBean > allSingletonBeansInOrder ( ) {
return this . testBean . orderedStream ( ObjectProvider . UNFILTERED , false ) . toList ( ) ;
}
}