You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide a way to predict bean types without initializing FactoryBeans #23374
I don't think we currently have a way to tell the predicted type of a bean without initializing it. It might be nice if we could either surface a getType(String name, boolean allowEagerInit) or perhaps add a callback based approach similar to the existing getBeanNames... methods:
changed the title [-]Provide a way to obtain bean types before without initiazing them[/-][+]Provide a way to obtain bean types before without initializing them[/+]on Aug 1, 2019
changed the title [-]Provide a way to obtain bean types before without initializing them[/-][+]Provide a way to predict bean types without initializing them[/+]on Sep 2, 2019
changed the title [-]Provide a way to predict bean types without initializing them[/-][+]Provide a way to predict bean types without initializing FactoryBeans[/+]on Sep 2, 2019
@philwebb Would you expect such a getType(String name, boolean allowFactoryBeanInit) method to be available on the BeanFactory interface, not just on the factory implementation hierarchy? And the flag would only affect the internal getTypeForFactoryBean call, I suppose?
@jhoeller I haven't given too much thought, but I assumed on the interface next to BeanFactory.getType(String name) would be best. It probably doesn't matter too from our side since we can always cast.
the flag would only affect the internal getTypeForFactoryBean call, I suppose?
I think so. I think all the other areas of the current implementation don't cause initialization.
Activity
[-]Provide a way to obtain bean types before without initiazing them[/-][+]Provide a way to obtain bean types before without initializing them[/+][-]Provide a way to obtain bean types before without initializing them[/-][+]Provide a way to predict bean types without initializing them[/+][-]Provide a way to predict bean types without initializing them[/-][+]Provide a way to predict bean types without initializing FactoryBeans[/+]jhoeller commentedon Sep 2, 2019
@philwebb Would you expect such a
getType(String name, boolean allowFactoryBeanInit)method to be available on theBeanFactoryinterface, not just on the factory implementation hierarchy? And the flag would only affect the internalgetTypeForFactoryBeancall, I suppose?philwebb commentedon Sep 2, 2019
@jhoeller I haven't given too much thought, but I assumed on the interface next to
BeanFactory.getType(String name)would be best. It probably doesn't matter too from our side since we can always cast.I think so. I think all the other areas of the current implementation don't cause initialization.
Introduce getType variant with allowFactoryBeanInit flag