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

Functional bean dependencies tracking [SPR-15417] #19979

spring-issuemaster opened this Issue Apr 5, 2017 · 1 comment


None yet
2 participants
Copy link

spring-issuemaster commented Apr 5, 2017

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:

  • #18353 Programmatic bean registration within configuration classes ("is depended on by")
  • #19398 Add a functional way to register a bean
  • #19635 Track bean dependencies for calls between @Bean methods within @Configuration classes

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Apr 7, 2017

Juergen Hoeller commented

I've implemented this through implicit tracking of all bean retrieval operations, effectively triggering a registerDependentBean call for every getBean etc operation from a Supplier callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.