Announcement Announcement Module
Collapse
No announcement yet.
Beans destroying order Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Beans destroying order

    Hi,

    Is it possible to say which bean must be destroyed at the end of spring context destroying procedure (or after some other bean)? I know about depends-on but it seams it works only on startup.

  • #2
    Hi

    Singleton beans are destroyed in the reverse order in which they were originaly resolved by the container.

    So if you have singleton bean 'foo' which has a dependency on singleton bean 'bar', when the enclosing container is closed (destroyed) then 'bar' will be disposed of before 'foo'.

    That is the only contract for singleton destruction that is currently offered by the container. The 'depends-on' attribute (in the case of XML-based configuration metadata) is used only indirectly to setup the dependency list once at startup.

    Cheers
    Rick

    Comment

    Working...
    X