Results 1 to 1 of 1

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

  1. #1
    Join Date
    May 2006
    Location
    Madrid
    Posts
    382

    Default 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 at 05:54 AM. Reason: I didn't like the title

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •