ConfigurationClassPostProcessor programmatically registers unified ImportAwareBeanPostProcessor

Issue: SPR-14931
This commit is contained in:
Juergen Hoeller
2016-12-20 12:16:16 +01:00
parent 30df137273
commit f6b2a21206
3 changed files with 21 additions and 77 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,29 +38,20 @@ public class Spr10668Tests {
@Test
public void testSelfInjectHierarchy() throws Exception {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
ChildConfig.class);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ChildConfig.class);
assertNotNull(context.getBean(MyComponent.class));
context.close();
}
@Configuration
public static class ParentConfig implements BeanFactoryAware {
public static class ParentConfig {
@Autowired(required = false)
MyComponent component;
public ParentConfig() {
System.out.println("Parent " + getClass());
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
System.out.println("BFA " + getClass());
}
}
@Configuration
public static class ChildConfig extends ParentConfig {
@@ -68,12 +59,11 @@ public class Spr10668Tests {
public MyComponentImpl myComponent() {
return new MyComponentImpl();
}
}
public static interface MyComponent {
}
public static class MyComponentImpl implements MyComponent {
}
public interface MyComponent {}
public static class MyComponentImpl implements MyComponent {}
}