Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to specify factory bean in BeanDefinitionBuilder [SPR-15098] #19665

Closed
spring-projects-issues opened this issue Jan 5, 2017 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 5, 2017

James Howe opened SPR-15098 and commented

For some reason, even though it has setFactoryMethod, it doesn't have setFactoryBeanName. You have to construct the BeanDefinition first, then add it.

BeanDefinition definition = BeanDefinitionBuilder
    .genericBeanDefinition(Foo.class)
    .setScope(BeanDefinition.SCOPE_SINGLETON)
    .setFactoryMethod("createFoo")
    .addConstructorArgValue(argValue)
    .getBeanDefinition();
definition.setFactoryBeanName("fooFactory");

Affects: 4.3.5

Referenced from: commits 2f2ef00, 9e6aa0f

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jan 12, 2017

Juergen Hoeller commented

I've added a corresponding setFactoryMethodOnBean(String factoryMethod, String factoryBean) variant on BeanDefinitionBuilder. Since those names aren't supposed to be modified independently on the builder, it seems easy enough to combine them into one call.

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.3.6 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants