LazyInitTargetSource works for @Bean targets as well
Issue: SPR-10508 Issue: SPR-8080
This commit is contained in:
@@ -296,7 +296,7 @@ class ConfigurationClassEnhancer {
|
||||
}
|
||||
}
|
||||
|
||||
if (isCurrentlyInvokedFactoryMethod(beanMethod) && !beanFactory.containsSingleton(beanName)) {
|
||||
if (isCurrentlyInvokedFactoryMethod(beanMethod)) {
|
||||
// The factory is calling the bean method in order to instantiate and register the bean
|
||||
// (i.e. via a getBean() call) -> invoke the super implementation of the method to actually
|
||||
// create the bean instance.
|
||||
@@ -306,7 +306,7 @@ class ConfigurationClassEnhancer {
|
||||
"result in a failure to process annotations such as @Autowired, " +
|
||||
"@Resource and @PostConstruct within the method's declaring " +
|
||||
"@Configuration class. Add the 'static' modifier to this method to avoid " +
|
||||
"these container lifecycle issues; see @Bean Javadoc for complete details",
|
||||
"these container lifecycle issues; see @Bean javadoc for complete details",
|
||||
beanMethod.getDeclaringClass().getSimpleName(), beanMethod.getName()));
|
||||
}
|
||||
return cglibMethodProxy.invokeSuper(enhancedConfigInstance, beanMethodArgs);
|
||||
|
||||
Reference in New Issue
Block a user