|
54 | 54 | import org.springframework.context.annotation.ContextAnnotationAutowireCandidateResolver;
|
55 | 55 | import org.springframework.context.support.GenericApplicationContext;
|
56 | 56 | import org.springframework.context.testfixture.context.annotation.AutowiredComponent;
|
| 57 | +import org.springframework.context.testfixture.context.annotation.AutowiredGenericTemplate; |
57 | 58 | import org.springframework.context.testfixture.context.annotation.CglibConfiguration;
|
58 | 59 | import org.springframework.context.testfixture.context.annotation.ConfigurableCglibConfiguration;
|
| 60 | +import org.springframework.context.testfixture.context.annotation.GenericTemplateConfiguration; |
59 | 61 | import org.springframework.context.testfixture.context.annotation.InitDestroyComponent;
|
60 | 62 | import org.springframework.context.testfixture.context.annotation.LazyAutowiredFieldComponent;
|
61 | 63 | import org.springframework.context.testfixture.context.annotation.LazyAutowiredMethodComponent;
|
@@ -114,6 +116,18 @@ void processAheadOfTimeWhenHasAutowiring() {
|
114 | 116 | });
|
115 | 117 | }
|
116 | 118 |
|
| 119 | + @Test |
| 120 | + void processAheadOfTimeWhenHasAutowiringOnUnresolvedGeneric() { |
| 121 | + GenericApplicationContext applicationContext = new AnnotationConfigApplicationContext(); |
| 122 | + applicationContext.registerBean(GenericTemplateConfiguration.class); |
| 123 | + applicationContext.registerBean("autowiredComponent", AutowiredGenericTemplate.class); |
| 124 | + testCompiledResult(applicationContext, (initializer, compiled) -> { |
| 125 | + GenericApplicationContext freshApplicationContext = toFreshApplicationContext(initializer); |
| 126 | + AutowiredGenericTemplate bean = freshApplicationContext.getBean(AutowiredGenericTemplate.class); |
| 127 | + assertThat(bean).hasFieldOrPropertyWithValue("genericTemplate", applicationContext.getBean("genericTemplate")); |
| 128 | + }); |
| 129 | + } |
| 130 | + |
117 | 131 | @Test
|
118 | 132 | void processAheadOfTimeWhenHasLazyAutowiringOnField() {
|
119 | 133 | testAutowiredComponent(LazyAutowiredFieldComponent.class, (bean, generationContext) -> {
|
|
0 commit comments