Announcement Announcement Module
Collapse
No announcement yet.
Loading Spring contexts from within different JARs on WebApp classpath Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 08:47 PM. Reason: Signature

  • #2
    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.

    Comment

    Working...
    X