Sébastien Deleuze opened SPR-15417 and commented
The new functional bean registration mechanism gets the type of the bean to register (via an explicit class parameter in Java or via reified type parameters in Kotlin) but unlike JavaConfig which declare explicitly bean dependencies as input @Bean method parameters, the functional variant don't know what bean dependency are needed because it is based on opaque applicationContext.getBean() invocations performed by the Supplier implementation.
Tracking those applicationContext.getBean() invocations would allow the functional bean registration mechanism to build the same kind of bean dependency graph than with JavaConfig, allowing to cover the same use cases and improving consistency between both approaches.
Issue Links:
Sébastien Deleuze opened SPR-15417 and commented
The new functional bean registration mechanism gets the type of the bean to register (via an explicit class parameter in Java or via reified type parameters in Kotlin) but unlike JavaConfig which declare explicitly bean dependencies as input
@Beanmethod parameters, the functional variant don't know what bean dependency are needed because it is based on opaqueapplicationContext.getBean()invocations performed by theSupplierimplementation.Tracking those
applicationContext.getBean()invocations would allow the functional bean registration mechanism to build the same kind of bean dependency graph than with JavaConfig, allowing to cover the same use cases and improving consistency between both approaches.Issue Links:
@Beanmethods within@Configurationclasses