BeanMethodInterceptor forwards user-provided arguments to getBean(name, args)

Issue: SPR-12443
This commit is contained in:
Juergen Hoeller
2014-11-22 16:06:25 +01:00
parent 75c70fac3d
commit 4bd75e4146
3 changed files with 82 additions and 32 deletions

View File

@@ -45,6 +45,7 @@ import org.springframework.cglib.transform.ClassEmitterTransformer;
import org.springframework.cglib.transform.TransformingClassGenerator;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
/**
@@ -321,7 +322,8 @@ class ConfigurationClassEnhancer {
if (alreadyInCreation) {
beanFactory.setCurrentlyInCreation(beanName, false);
}
return beanFactory.getBean(beanName);
return (!ObjectUtils.isEmpty(beanMethodArgs) ?
beanFactory.getBean(beanName, beanMethodArgs) : beanFactory.getBean(beanName));
}
finally {
if (alreadyInCreation) {