IN PROGRESS - issue SPR-6779: imported @Configuration classes do not get enhanced and fail to satisfy scoping requirements

All tests in ImportedConfigurationClassEnhancementTests now pass.  The fix was simple - imported @Configuration class bean definitions were not getting marked with the attribute that indicates that they are indeed @Configuration class bean definitions.  To make this happen, ConfigurationClassPostProcessor's protected checkConfigurationClassCandidate(beanDef) method is being called from within ConfigurationClassBeanDefinitionReader when imported @Configuration classes are being processed.  This is quick and dirty, and the subsequent check-in will refactor the solution appropriately.
This commit is contained in:
Chris Beams
2010-01-29 20:55:03 +00:00
parent 5fdee47841
commit 110b032ad9
4 changed files with 13 additions and 12 deletions

View File

@@ -106,6 +106,7 @@ class ConfigurationClassBeanDefinitionReader {
if (configClass.getBeanName() == null) {
GenericBeanDefinition configBeanDef = new GenericBeanDefinition();
configBeanDef.setBeanClassName(configClass.getMetadata().getClassName());
new ConfigurationClassPostProcessor().checkConfigurationClassCandidate(configBeanDef);
String configBeanName = BeanDefinitionReaderUtils.registerWithGeneratedName(configBeanDef, this.registry);
configClass.setBeanName(configBeanName);
if (logger.isDebugEnabled()) {

View File

@@ -90,8 +90,8 @@ class ConfigurationClassEnhancer {
logger.debug("Enhancing " + configClass.getName());
}
Class<?> enhancedClass = createClass(newEnhancer(configClass));
if (logger.isInfoEnabled()) {
logger.info(String.format("Successfully enhanced %s; enhanced class name is: %s",
if (logger.isDebugEnabled()) {
logger.debug(String.format("Successfully enhanced %s; enhanced class name is: %s",
configClass.getName(), enhancedClass.getName()));
}
return enhancedClass;