|
|
|
|
@ -39,6 +39,7 @@ import org.springframework.beans.factory.FactoryBean;
@@ -39,6 +39,7 @@ import org.springframework.beans.factory.FactoryBean;
|
|
|
|
|
import org.springframework.beans.factory.NoSuchBeanDefinitionException; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; |
|
|
|
|
import org.springframework.beans.factory.annotation.Lookup; |
|
|
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
|
|
import org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver; |
|
|
|
|
import org.springframework.beans.factory.config.BeanDefinitionHolder; |
|
|
|
|
@ -779,6 +780,14 @@ public class ConfigurationClassPostProcessorTests {
@@ -779,6 +780,14 @@ public class ConfigurationClassPostProcessorTests {
|
|
|
|
|
assertSame(ctx.getBean(TestBean.class), bean.testBeans.get(0)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testBeanLookupFromSameConfigurationClass() { |
|
|
|
|
ApplicationContext ctx = new AnnotationConfigApplicationContext(BeanLookupConfiguration.class); |
|
|
|
|
BeanLookupConfiguration bean = ctx.getBean(BeanLookupConfiguration.class); |
|
|
|
|
assertNotNull(bean.getTestBean()); |
|
|
|
|
assertSame(ctx.getBean(TestBean.class), bean.getTestBean()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
@ -1448,4 +1457,16 @@ public class ConfigurationClassPostProcessorTests {
@@ -1448,4 +1457,16 @@ public class ConfigurationClassPostProcessorTests {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
|
static abstract class BeanLookupConfiguration { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public TestBean thing() { |
|
|
|
|
return new TestBean(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Lookup |
|
|
|
|
public abstract TestBean getTestBean(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|