Announcement Announcement Module
No announcement yet.
Refreshing Application Contexts Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Refreshing Application Contexts


    I'm thinking of doing some UI work using Spring to configure factories for my components. The thing I'm ideally after is a way for the bean definitions to be updated without restarting the application.

    Obviously this just isn't possible with singleton beans, but I'm talking about creating new forms and components on them, which could be new instances for each form shown. If I could update the defs in the beans.xml and it autorefreshes in someway so I can redisplay the form without having to restart my app it would save a LOT of development time.


  • #2
    I'm very interested in this as well. I'm using spring to create actions for webwork/xwork. XWork supports reloading of the config file and it would be great if Spring did too. What I've thought of doing is creating two contexts with a parent child relationship. The parent defines all singletons and the child all the prototype beans. Then register the child with webwork and check it's config files for timestamp changes. When the config file changes simply recreate the child context and set its parent to the unchanged singleton context. Does this sound feasible?


    • #3
      Could you acheive this by leveraging ource
      ? If you have something like a single entry point, and lots of dependent objects defined in a child application context, you could wrap that entry point in a HotSwappableTargetSource and monitor the config file for changes. If you detect any, reload the application context and call swap()...

      Any good?



      • #4
        I now have this working but unfortunately it's a purely XWork solution. A surprise I ran in to is that BeanPostProcessors are not inherited from parent contexts. dhewitt, thatnks for the suggestion. I started with it but realized there would be a simpler xwork solution.