Results 1 to 2 of 2

Thread: Loading Spring contexts from within different JARs on WebApp classpath

  1. #1
    Join Date
    Jan 2005
    Posts
    8

    Question Loading Spring contexts from within different JARs on WebApp classpath

    Hello,

    I have a web.xml for an application configured like such:

    Code:
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:context-*.xml</param-value>
    </context-param>
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    The classpath context reference is intended to pull spring context files from the root of the classpath. Essentially I have two files context-dao.xml and context-datasource.xml that are within a JAR file in the webapp's /WEB-INF/lib. Is is possible to load these context files using the web.xml or would the context files need to exist in some package on the classpath (in jar or not)?

    Any help would be great!
    Thanks
    Last edited by abargnesi; Jul 24th, 2007 at 08:47 PM. Reason: Signature
    Anthony Bargnesi
    Web Developer
    Aquent

    \'There\'s no place like 127.0.0.1\'

  2. #2
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    I think classpath:* is doomed from the start - Spring has to choose a directory to search - it definitely won't work with multiple directories, so multiple jars might not also work. However classpath*:filename.xml would work. You can look at the PathMatchingResourcePatternResolver and play with it to see what is possible and what is not.

Posting Permissions

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