Announcement Announcement Module
No announcement yet.
Multiple init sequences in a web application Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple init sequences in a web application


    The system I'm working on is built of a single web application that includes 3 disconnected subsystems.

    The system bootstrap consists of a ContextLoaderListener that loads all context files.

    The context structure is such that there is one common context file + 3 context files that rely on that context file but are decoupled.

    Therefore, if there is any problem loading either of the subsystems context files the whole initialization sequence fails and the whole web application down together with the subsystems that could run successfully.

    What I'd like to achieve is that once the common context file loads, the other three each could succeed or fail without failing the whole web application (so it will be possible to work on whichever succeeded). This is especially important when multiple developers are working on an unstable system as it develops.

    Since there is a common contextConfigLocation parameter I couldn't find a way to supply multiple of them. I tried switching to ContextServletListener (which at least doesn't fail the webapp) but still couldn't find a way to have 3 different of them.


  • #2
    There is no multiple parents in the ApplicationContext hierarchy, so you would have to specify all 3 context files in one context. However, you might consider writing a custom version of ClassPathXmlApplicationContext that allows any one of the specified locations to fail to load and not have the whole context fail.

    The problem with that will be however, that any dependencies from the web application will fail if they can't find the missing objects in the other context. They way around that is to use lazy-init in your web application's context so as long as you don't touch the page which ultimately refers to the missing object in the failed component context, you should be fine.