Announcement Announcement Module
No announcement yet.
Destroy & re-initializing a bean.... Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Destroy & re-initializing a bean....


    All the Services (beans) in my application context are defined as Singleton. And some of the services are being injected in another service, thus having a hard reference to the service.

    The admin part of this application, allows the adminstrator to manages these services; allowing the manager to destroy one or more services.

    When a service is destroyed, I would like
    a) a new instance of the service to be created
    b) the old reference of the service should be replaced with the new reference of the service, without restarting my application.

    Eg : There are two beans defined in app. context called : ServiceA & ServiceB. ServiceB is injected in ServiceA. The admin tries to destroy the ServiceB. Now, a new instance of ServiceB should be created and its reference should be injected in ServiceA

    Is there anyways to get this done in Spring ? Has anyone tried it ?

    Would appreciate you comments on this.

    Thanks a ton,
    Amit Chhajed.

  • #2
    Take a look at HotSwappableTargetSource in the reference.



    • #3
      that is super cool...

      Thanks very much...Injecteer !!!