Skip to content

Use available type information in functional bean definitions for resolving FactoryBean type [SPR-17063] #21601

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

Closed
spring-projects-issues opened this issue Jul 19, 2018 · 2 comments
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 Jul 19, 2018

Dave Syer opened SPR-17063 and commented

I encountered a nasty problem with some functional bean registrations, caused by early an instantiation cascade driven from a BeanFactoryPostProcessor in Spring Data. The issue comes back to the BFPP wanting to find bean definitions of a certain type, so it uses BeanFactory.getType(String), which could have used the ResolvableType information that was available for the functional bean definition, but didn't and fell back to instantiating the bean to check its runtime concrete type. The offending code is in AbstractBeanFactory.


Issue Links:

Referenced from: commits 52d124d

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

AbstractBeanFactory.getType checks RootBeanDefinition.getTargetType() in its regular code path... Did it not end up there for some reason, or was the Class based type information not sufficient for that particular type check attempt?

@spring-projects-issues
Copy link
Collaborator Author

Dave Syer commented

That wasn't working. I think because it is a FactoryBean (makes sense given the Spring Data context - it was looking at LocalEntityManagerFactoryBean).

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