|
|
|
@ -43,6 +43,9 @@ import org.springframework.beans.factory.annotation.Lookup;
@@ -43,6 +43,9 @@ 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; |
|
|
|
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; |
|
|
|
|
import org.springframework.beans.factory.support.BeanDefinitionRegistry; |
|
|
|
|
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; |
|
|
|
|
import org.springframework.beans.factory.support.ChildBeanDefinition; |
|
|
|
|
import org.springframework.beans.factory.support.DefaultListableBeanFactory; |
|
|
|
|
import org.springframework.beans.factory.support.RootBeanDefinition; |
|
|
|
@ -806,6 +809,12 @@ public class ConfigurationClassPostProcessorTests {
@@ -806,6 +809,12 @@ public class ConfigurationClassPostProcessorTests {
|
|
|
|
|
ctx.getBean("myTestBean", TestBean.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testBeanDefinitionRegistryPostProcessorConfig() { |
|
|
|
|
ApplicationContext ctx = new AnnotationConfigApplicationContext(BeanDefinitionRegistryPostProcessorConfig.class); |
|
|
|
|
assertTrue(ctx.getBean("myTestBean") instanceof TestBean); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
@ -902,8 +911,7 @@ public class ConfigurationClassPostProcessorTests {
@@ -902,8 +911,7 @@ public class ConfigurationClassPostProcessorTests {
|
|
|
|
|
@Configuration |
|
|
|
|
static class UnloadedConfig { |
|
|
|
|
|
|
|
|
|
public @Bean |
|
|
|
|
Foo foo() { |
|
|
|
|
public @Bean Foo foo() { |
|
|
|
|
return new Foo(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -911,8 +919,7 @@ public class ConfigurationClassPostProcessorTests {
@@ -911,8 +919,7 @@ public class ConfigurationClassPostProcessorTests {
|
|
|
|
|
@Configuration |
|
|
|
|
static class LoadedConfig { |
|
|
|
|
|
|
|
|
|
public @Bean |
|
|
|
|
Bar bar() { |
|
|
|
|
public @Bean Bar bar() { |
|
|
|
|
return new Bar(new Foo()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -926,9 +933,7 @@ public class ConfigurationClassPostProcessorTests {
@@ -926,9 +933,7 @@ public class ConfigurationClassPostProcessorTests {
|
|
|
|
|
@Configuration |
|
|
|
|
public static class ScopedProxyConfigurationClass { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
@Lazy |
|
|
|
|
@Scope(proxyMode = ScopedProxyMode.INTERFACES) |
|
|
|
|
@Bean @Lazy @Scope(proxyMode = ScopedProxyMode.INTERFACES) |
|
|
|
|
public ITestBean scopedClass() { |
|
|
|
|
return new TestBean(); |
|
|
|
|
} |
|
|
|
@ -1517,4 +1522,21 @@ public class ConfigurationClassPostProcessorTests {
@@ -1517,4 +1522,21 @@ public class ConfigurationClassPostProcessorTests {
|
|
|
|
|
public abstract TestBean getTestBean(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
|
static class BeanDefinitionRegistryPostProcessorConfig { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public static BeanDefinitionRegistryPostProcessor bdrpp() { |
|
|
|
|
return new BeanDefinitionRegistryPostProcessor() { |
|
|
|
|
@Override |
|
|
|
|
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) { |
|
|
|
|
registry.registerBeanDefinition("myTestBean", new RootBeanDefinition(TestBean.class)); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|