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-issuemaster opened this issue Jan 5, 2017 · 1 comment

Comments

@spring-issuemaster
Copy link
Collaborator

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-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.