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

  • Refreshing Application Context

    When we refresh the application context then all the existing bean are destroyed including singleton classes and all the beans are re-created and wired.

    I have case where my applicationcontext.xml is updated different program in runtime(Shell script). I have written a File Watcher thread with the Listener class. When ever the application context is changed please refresh the context.

    Is there anyway that we can reload the context without destroying the existing beans. Means only newly added bean are instantiated.


    Thanks in advance
    -Bharat

  • #2
    Is there anyway that we can reload the context without destroying the existing beans. Means only newly added bean are instantiated.
    No... Not with the current implementations. Newly added or modified beans can lead to other beans needing to be reloaded (imagine beans that load all beans of type X and you add a Bean of type x and that bean wouldn't be reloaded).

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      No... Not with the current implementations. Newly added or modified beans can lead to other beans needing to be reloaded (imagine beans that load all beans of type X and you add a Bean of type x and that bean wouldn't be reloaded).
      You perhaps think of serialization of required beans before refresh then replace members of newly create singleton object by serialized one.

      Hope that might help!

      Comment


      • #4
        Hi Pulin,

        Thanks for the suggestion. Instead of the serialization some how i can extend the ApplictionContext and redefined the refresh method to load only new Beans. I just want to check is there any predefined way to do that.

        Thanks in advance
        -Bharat

        Comment

        Working...
        X