Skip to content

Commit 5fb4103

Browse files
committed
Polishing
1 parent 74a0aee commit 5fb4103

File tree

2 files changed

+15
-25
lines changed

2 files changed

+15
-25
lines changed

spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.springframework.beans.factory.BeanDefinitionStoreException;
3838
import org.springframework.beans.factory.BeanFactory;
3939
import org.springframework.beans.factory.BeanFactoryAware;
40-
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
4140
import org.springframework.beans.factory.config.BeanDefinition;
4241
import org.springframework.beans.factory.config.BeanDefinitionHolder;
4342
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
@@ -91,12 +90,12 @@
9190
public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPostProcessor,
9291
PriorityOrdered, ResourceLoaderAware, BeanClassLoaderAware, EnvironmentAware {
9392

94-
private static final String IMPORT_AWARE_PROCESSOR_BEAN_NAME =
95-
ConfigurationClassPostProcessor.class.getName() + ".importAwareProcessor";
96-
9793
private static final String IMPORT_REGISTRY_BEAN_NAME =
9894
ConfigurationClassPostProcessor.class.getName() + ".importRegistry";
9995

96+
private static final String IMPORT_AWARE_PROCESSOR_BEAN_NAME =
97+
ConfigurationClassPostProcessor.class.getName() + ".importAwareProcessor";
98+
10099
private static final String ENHANCED_CONFIGURATION_PROCESSOR_BEAN_NAME =
101100
ConfigurationClassPostProcessor.class.getName() + ".enhancedConfigurationProcessor";
102101

@@ -260,6 +259,7 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
260259
// Simply call processConfigurationClasses lazily at this point then.
261260
processConfigBeanDefinitions((BeanDefinitionRegistry) beanFactory);
262261
}
262+
263263
enhanceConfigurationClasses(beanFactory);
264264
}
265265

@@ -455,10 +455,10 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {
455455
/**
456456
* {@link InstantiationAwareBeanPostProcessorAdapter} that ensures
457457
* {@link EnhancedConfiguration} beans are injected with the {@link BeanFactory}
458-
* before the {@link AutowiredAnnotationBeanPostProcessor} runs (SPR-10668).
458+
* before the {@code AutowiredAnnotationBeanPostProcessor} runs (SPR-10668).
459459
*/
460460
private static class EnhancedConfigurationBeanPostProcessor extends InstantiationAwareBeanPostProcessorAdapter
461-
implements PriorityOrdered, BeanFactoryAware {
461+
implements BeanFactoryAware, PriorityOrdered {
462462

463463
private BeanFactory beanFactory;
464464

spring-context/src/test/java/org/springframework/context/annotation/configuration/Spr10668Tests.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,42 +38,32 @@ public class Spr10668Tests {
3838

3939
@Test
4040
public void testSelfInjectHierarchy() throws Exception {
41-
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
42-
ChildConfig.class);
41+
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ChildConfig.class);
4342
assertNotNull(context.getBean(MyComponent.class));
4443
context.close();
4544
}
4645

46+
4747
@Configuration
48-
public static class ParentConfig implements BeanFactoryAware {
48+
public static class ParentConfig {
4949

5050
@Autowired(required = false)
5151
MyComponent component;
52-
53-
public ParentConfig() {
54-
System.out.println("Parent " + getClass());
55-
}
56-
57-
@Override
58-
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
59-
System.out.println("BFA " + getClass());
60-
}
61-
6252
}
6353

54+
6455
@Configuration
6556
public static class ChildConfig extends ParentConfig {
6657

6758
@Bean
6859
public MyComponentImpl myComponent() {
6960
return new MyComponentImpl();
7061
}
71-
7262
}
7363

74-
public static interface MyComponent {
75-
}
7664

77-
public static class MyComponentImpl implements MyComponent {
78-
}
65+
public interface MyComponent {}
66+
67+
public static class MyComponentImpl implements MyComponent {}
68+
7969
}

0 commit comments

Comments
 (0)