Announcement Announcement Module

JavaConfig forum decommissioned in favor of Core Container

As described at

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at
See more
See less
Lifecycle and hidden beans Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lifecycle and hidden beans

    We just spent some time trying to figure out why a bean that implements Lifecycle created by a config was not being invoked. After a bit of debugging we discovered that the bean was being created in nested context. And a bit later we noticed the @Bean method was not public, hence the bean was created as "hidden". (A really really nice feature BTW.)

    A side effect of a hidden beans is that lifecycle events in the top/public context are not propagated to the hidden/nested context.

    Is this just a gap in the javaconfig implementation, or is there some other mechanism that must be used for hidden beans to participate in lifecycle?

  • #2
    Hi Barry,

    Though this might not be the answer you're hoping for, the issue that you're experiencing will no longer be a problem if you upgrade to the latest snapshots, because the bean visibility feature has been eliminated for M5.

    Though this is a neat feature, its implementation was too simply too complex to maintain going forward. Feel free to comment on the issue above with your use case for the feature and whether you'd like to see it come back. No promises on this, but we may re-introduce bean visibility if it is popular enough. If and when it is, it will be with a more sustainable implementation.


    • #3
      Its not blocking us now; the declaration of the private bean was not intentional. And dropping private beans is fine by me.