Announcement Announcement Module
Collapse
No announcement yet.
Advice: load order of application context files in a multi-module/imported-jars (web) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Advice: load order of application context files in a multi-module/imported-jars (web)

    I've been working for a while with projects that try to use code from other projects by directly importing them as jars (actually, adding jar maven depeendecies)

    Now I'm trying the maven multi-module Roo 1.2 feature.

    But if you have a web project and many related application contexts, you can have a problem starting the web application in the server.

    In my case, I'm talking about the webmvc-config.xml plus and applicationContext.xml files from other modules with custom applicationContext.xml files to configure them and the applicationContext-security.xml and even some applicationContext.xml with beans for custom security (please, don't judge me, it's due to weird requirements)

    What is the problem?

    In the web.xml, you can't guarantee the load order with the line:

    Code:
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>
        </context-param>
    (Thanks classloader)

    What do I do?

    I force the load order in the web.xml:

    Code:
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
            	classpath*:META-INF/spring/applicationContext-multi-core.xml
            	classpath*:META-INF/spring/applicationContext.xml
            	classpath*:META-INF/spring/applicationContext-custom-security.xml
            	classpath*:META-INF/spring/applicationContext-security.xml
            </param-value>
        </context-param>
    Last edited by jbbarquero; Jan 19th, 2012, 06:54 AM. Reason: I didn't like the title
Working...
X