BeanDefinitionBuilder supports factory method on factory bean

Issue: SPR-15098
(cherry picked from commit 9e6aa0f)
This commit is contained in:
Juergen Hoeller 2017-01-12 21:15:22 +01:00
parent de7eea4498
commit 2f2ef00d1f
1 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -159,13 +159,25 @@ public class BeanDefinitionBuilder {
} }
/** /**
* Set the name of the factory method to use for this definition. * Set the name of a static factory method to use for this definition,
* to be called on this bean's class.
*/ */
public BeanDefinitionBuilder setFactoryMethod(String factoryMethod) { public BeanDefinitionBuilder setFactoryMethod(String factoryMethod) {
this.beanDefinition.setFactoryMethodName(factoryMethod); this.beanDefinition.setFactoryMethodName(factoryMethod);
return this; return this;
} }
/**
* Set the name of a non-static factory method to use for this definition,
* including the bean name of the factory instance to call the method on.
* @since 4.3.6
*/
public BeanDefinitionBuilder setFactoryMethodOnBean(String factoryMethod, String factoryBean) {
this.beanDefinition.setFactoryMethodName(factoryMethod);
this.beanDefinition.setFactoryBeanName(factoryBean);
return this;
}
/** /**
* Add an indexed constructor arg value. The current index is tracked internally * Add an indexed constructor arg value. The current index is tracked internally
* and all additions are at the present point. * and all additions are at the present point.