Skip to content

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

Closed

Description

@spring-projects-issues

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

Activity

  1. spring-projects-issues commented on Jul 19, 2018

    @spring-projects-issues
    CollaboratorAuthor

    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?

  2. spring-projects-issues commented on Jul 19, 2018

    @spring-projects-issues
    CollaboratorAuthor

    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).

  3. added
    type: enhancement
    in: core
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions