Buggy code:
public class ConfigurationClassPostProcessor implements BeanClassLoaderAware , BeanDefinitionRegistryPostProcessor , EnvironmentAware , ResourceLoaderAware , PriorityOrdered { private static final String IMPORT_AWARE_PROCESSOR_BEAN_NAME = ( ConfigurationClassPostProcessor . class . getName ( ) ) + ".importAwareProcessor" ; private static final String IMPORT_REGISTRY_BEAN_NAME = ( ConfigurationClassPostProcessor . class . getName ( ) ) + ".importRegistry" ; private static final String ENHANCED_CONFIGURATION_PROCESSOR_BEAN_NAME = ( ConfigurationClassPostProcessor . class . getName ( ) ) + ".enhancedConfigurationProcessor" ; private final Log logger = LogFactory . getLog ( getClass ( ) ) ; private SourceExtractor sourceExtractor = new PassThroughSourceExtractor ( ) ; private ProblemReporter problemReporter = new FailFastProblemReporter ( ) ; private Environment environment ; private ResourceLoader resourceLoader = new DefaultResourceLoader ( ) ; private ClassLoader beanClassLoader = ClassUtils . getDefaultClassLoader ( ) ; private MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory ( ) ; private boolean setMetadataReaderFactoryCalled = false ; private final Set < Integer > registriesPostProcessed = new HashSet < Integer > ( ) ; private final Set < Integer > factoriesPostProcessed = new HashSet < Integer > ( ) ; private ConfigurationClassBeanDefinitionReader reader ; private boolean localBeanNameGeneratorSet = false ; private BeanNameGenerator componentScanBeanNameGenerator = new AnnotationBeanNameGenerator ( ) ; private BeanNameGenerator importBeanNameGenerator = new AnnotationBeanNameGenerator ( ) { @ Override protected String buildDefaultBeanName ( BeanDefinition definition ) { } } ; @ Override public int getOrder ( ) { } public void setSourceExtractor ( SourceExtractor sourceExtractor ) { } public void setProblemReporter ( ProblemReporter problemReporter ) { } public void setMetadataReaderFactory ( MetadataReaderFactory metadataReaderFactory ) { } public void setBeanNameGenerator ( BeanNameGenerator beanNameGenerator ) { } @ Override public void setEnvironment ( Environment environment ) { } @ Override public void setResourceLoader ( ResourceLoader resourceLoader ) { } @ Override public void setBeanClassLoader ( ClassLoader beanClassLoader ) { } @ Override public void postProcessBeanDefinitionRegistry ( BeanDefinitionRegistry registry ) { } @ Override public void postProcessBeanFactory ( ConfigurableListableBeanFactory beanFactory ) { } public void processConfigBeanDefinitions ( BeanDefinitionRegistry registry ) { Set < BeanDefinitionHolder > configCandidates = new LinkedHashSet < BeanDefinitionHolder > ( ) ; String [ ] candidateNames = registry . getBeanDefinitionNames ( ) ; for ( String beanName : candidateNames ) { BeanDefinition beanDef = registry . getBeanDefinition ( beanName ) ; if ( ( ConfigurationClassUtils . isFullConfigurationClass ( beanDef ) ) || ( ConfigurationClassUtils . isLiteConfigurationClass ( beanDef ) ) ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( ( "Bean<seq2seq4repair_space>definition<seq2seq4repair_space>has<seq2seq4repair_space>already<seq2seq4repair_space>been<seq2seq4repair_space>processed<seq2seq4repair_space>as<seq2seq4repair_space>a<seq2seq4repair_space>configuration<seq2seq4repair_space>class:<seq2seq4repair_space>" + beanDef ) ) ; } } else if ( ConfigurationClassUtils . checkConfigurationClassCandidate ( beanDef , this . metadataReaderFactory ) ) { configCandidates . add ( new BeanDefinitionHolder ( beanDef , beanName ) ) ; } } if ( configCandidates . isEmpty ( ) ) { return ; } SingletonBeanRegistry singletonRegistry = null ; if ( registry instanceof SingletonBeanRegistry ) { singletonRegistry = ( ( SingletonBeanRegistry ) ( registry ) ) ; if ( ( ! ( this . localBeanNameGeneratorSet ) ) && ( singletonRegistry . containsSingleton ( CONFIGURATION_BEAN_NAME_GENERATOR ) ) ) { BeanNameGenerator generator = ( ( BeanNameGenerator ) ( singletonRegistry . getSingleton ( CONFIGURATION_BEAN_NAME_GENERATOR ) ) ) ; this . componentScanBeanNameGenerator = generator ; this . importBeanNameGenerator = generator ; } } ConfigurationClassParser parser = new ConfigurationClassParser ( this . metadataReaderFactory , this . problemReporter , this . environment , this . resourceLoader , this . componentScanBeanNameGenerator , registry ) ; Set < ConfigurationClass > alreadyParsed = new HashSet < ConfigurationClass > ( configCandidates . size ( ) ) ; do { parser . parse ( configCandidates ) ; parser . validate ( ) ; Set < ConfigurationClass > configClasses = new LinkedHashSet < ConfigurationClass > ( parser . getConfigurationClasses ( ) ) ; configClasses . removeAll ( alreadyParsed ) ; if ( ( this . reader ) == null ) { <START_BUG> this . reader = new ConfigurationClassBeanDefinitionReader ( registry , this . sourceExtractor , this . problemReporter , this . metadataReaderFactory , this . resourceLoader , this . environment , this . importBeanNameGenerator ) ; <END_BUG> } this . reader . loadBeanDefinitions ( configClasses ) ; alreadyParsed . addAll ( configClasses ) ; configCandidates . clear ( ) ; if ( ( registry . getBeanDefinitionCount ( ) ) > ( candidateNames . length ) ) { String [ ] newCandidateNames = registry . getBeanDefinitionNames ( ) ; Set < String > oldCandidateNames = new HashSet < String > ( Arrays . asList ( candidateNames ) ) ; for ( String candidateName : newCandidateNames ) { if ( ! ( oldCandidateNames . contains ( candidateName ) ) ) { BeanDefinition beanDef = registry . getBeanDefinition ( candidateName ) ; if ( ConfigurationClassUtils . checkConfigurationClassCandidate ( beanDef , this . metadataReaderFactory ) ) { configCandidates . add ( new BeanDefinitionHolder ( beanDef , candidateName ) ) ; } } } candidateNames = newCandidateNames ; } } while ( ! ( configCandidates . isEmpty ( ) ) ) ; if ( singletonRegistry != null ) { if ( ! ( singletonRegistry . containsSingleton ( ConfigurationClassPostProcessor . IMPORT_REGISTRY_BEAN_NAME ) ) ) { singletonRegistry . registerSingleton ( ConfigurationClassPostProcessor . IMPORT_REGISTRY_BEAN_NAME , parser . getImportRegistry ( ) ) ; } } if ( ( this . metadataReaderFactory ) instanceof CachingMetadataReaderFactory ) { ( ( CachingMetadataReaderFactory ) ( this . metadataReaderFactory ) ) . clearCache ( ) ; } } public void enhanceConfigurationClasses ( ConfigurableListableBeanFactory beanFactory ) { } private static class ImportAwareBeanPostProcessor implements BeanFactoryAware , BeanPostProcessor , PriorityOrdered { private BeanFactory beanFactory ; @ Override public void setBeanFactory ( BeanFactory beanFactory ) { } @ Override public int getOrder ( ) { } @ Override public Object postProcessBeforeInitialization ( Object bean , String beanName ) { } @ Override public Object postProcessAfterInitialization ( Object bean , String beanName ) { } } private static class EnhancedConfigurationBeanPostProcessor extends InstantiationAwareBeanPostProcessorAdapter implements BeanFactoryAware , PriorityOrdered { private BeanFactory beanFactory ; @ Override public int getOrder ( ) { } @ Override public void setBeanFactory ( BeanFactory beanFactory ) { }

Fix:
this . reader = new ConfigurationClassBeanDefinitionReader ( registry , this . sourceExtractor , this . problemReporter , this . metadataReaderFactory , this . resourceLoader , this . environment , this . importBeanNameGenerator , parser . getImportRegistry ( ) ) ;