Ignore InstanceSupplier for getBean with arguments
Previously, a BeanDefinition that has an instance supplier would be used irrespective of custom arguments being provided. This commit only applies the instance supplier if no arguments are provided. With custom arguments, the regular lookup takes place based on the information provided in the bean factory. Closes gh-32657
This commit is contained in:
@@ -1156,9 +1156,11 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
"Bean class isn't public, and non-public access not allowed: " + beanClass.getName());
|
||||
}
|
||||
|
||||
Supplier<?> instanceSupplier = mbd.getInstanceSupplier();
|
||||
if (instanceSupplier != null) {
|
||||
return obtainFromSupplier(instanceSupplier, beanName, mbd);
|
||||
if (args == null) {
|
||||
Supplier<?> instanceSupplier = mbd.getInstanceSupplier();
|
||||
if (instanceSupplier != null) {
|
||||
return obtainFromSupplier(instanceSupplier, beanName, mbd);
|
||||
}
|
||||
}
|
||||
|
||||
if (mbd.getFactoryMethodName() != null) {
|
||||
|
||||
Reference in New Issue
Block a user