Raise log level to warn when enhancement cannot apply
Closes gh-31102
This commit is contained in:
@@ -506,11 +506,12 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||
throw new BeanDefinitionStoreException("Cannot enhance @Configuration bean definition '" +
|
||||
beanName + "' since it is not stored in an AbstractBeanDefinition subclass");
|
||||
}
|
||||
else if (logger.isInfoEnabled() && beanFactory.containsSingleton(beanName)) {
|
||||
logger.info("Cannot enhance @Configuration bean definition '" + beanName +
|
||||
else if (logger.isWarnEnabled() && beanFactory.containsSingleton(beanName)) {
|
||||
logger.warn("Cannot enhance @Configuration bean definition '" + beanName +
|
||||
"' since its singleton instance has been created too early. The typical cause " +
|
||||
"is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor " +
|
||||
"return type: Consider declaring such methods as 'static'.");
|
||||
"return type: Consider declaring such methods as 'static' and/or mark the " +
|
||||
"containing configuration class as 'proxyBeanMethods=false'.");
|
||||
}
|
||||
configBeanDefs.put(beanName, abd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user