Announcement Announcement Module
No announcement yet.
Refreshing applicationContext on the fly Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Refreshing applicationContext on the fly

    I am looking for some ideas on how to refresh my applicationContext with out restarting the application by invoking following line of code.
    ((XMLWebApplicationContext)applicationContext).ref resh();

    I have few approaches in mind to achieve this, please comment on them

    1) Have a button on the webpage during development phase click on it to invoke a servlet which would retrieve applicationContext by some means(from a bean that implements ApplicationContextAware/ get from servletContext attribute) and then refresh it

    2) I am not sure if this would work, I want to access the applicationContext from a class outside the web application. is there a way to access ServletContext from a class not with in the web application. Like can i go to where my application is installed through the filesystem and run a class which accesses ServletContext or applicationcontext directly. If i can do that i could write an ant task or maven goal to run that program to refresh my applicationContext on the fly with out having to restart the app.

    Thanks in advance

  • #2
    I think someone posted some ideas how to refresh the application context a while ago in this forum.