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

Explicitly notify when a bean initialized using factory bean paradigm also implements FactoryBean [SPR-9981] #14615

Closed
spring-projects-issues opened this issue Nov 11, 2012 · 1 comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: invalid An issue that we don't feel is valid

Comments

@spring-projects-issues
Copy link
Collaborator

Mukarram Baig opened SPR-9981 and commented

When upgrading from 3.1.0 to 3.1.1, we noticed that a few factory bean definitions using the static method paradigm started to fail with a org.springframework.beans.factory.BeanIsNotAFactoryException: Bean named 'fooFactoryBean' must be of type [org.springframework.beans.factory.FactoryBean], but was actually of type [com.kilo.SpecialObject]. On further inspection, it turned out that the class itself was also implementing FactoryBean and hence the container was getting confused. Leveraging on the FactoryBean approach alone or not implementing the FactoryBean interface alone also solved the problems and it made sense, since I cannot think of a reason why someone may want two ways of getting a bean from it. However, since it used to work fine (by fine I mean without throwing any errors) upto 3.1.0, maybe it is a good idea to detect such a bean definition and flag it explicitly so that the clients can fix their code easily. Attaching a sample maven project where we can see the error in action. I searched through the release notes of 3.1.1 where I could find the changed behavior.

Thanks in advance!


Affects: 3.1.1

Reference URL: http://stackoverflow.com/questions/13309921/spring-factorybean-error-in-spring-3-1-1-but-not-in-3-1-0

Attachments:

@spring-projects-issues
Copy link
Collaborator Author

Sébastien Deleuze commented

Closing groups of outdated issues. Please reopen if still relevant.

@spring-projects-issues spring-projects-issues added type: bug A general bug status: invalid An issue that we don't feel is valid in: core Issues in core modules (aop, beans, core, context, expression) and removed type: bug A general bug labels 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) status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

1 participant