ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reuben Firmin <reuben.fir...@cnet.com>
Subject Re: Resources
Date Fri, 20 Jan 2006 17:07:35 GMT
If you use this Spring class, you can get resources from jars...


     * @param resource e.g. "classpath:your/package/here/Blah.xml"

    public static Resource getClasspathResource(String resource) {
        PathMatchingResourcePatternResolver res = new 
PathMatchingResourcePatternResolver();
        return res.getResource(resource);
    }

Clinton Begin wrote:

> Because JAR files mess up the resource path.  You'd probably have to 
> use something goofy like "jar!/sqlMapConfig.xml"....but I wouldn't 
> depend upon that.  I suggest just putting them in WEB-INF/classes.
>
> Clinton
>
> On 1/20/06, *Tony Qian* <daqiqian2@aol.com <mailto:daqiqian2@aol.com>> 
> wrote:
>
>     Can someone tell why
>     Resources.getResourceAsReader(sqlMapConfig.xml) can not find the
>     sqlMapConfig.xml and sql mapping xml files if I package them
>     inside jar file? When I put them under WEB-INF/classes/ (i'm using
>     tomcat), everything works okay.
>
>     Thanks,
>     Tony
>
>

Mime
View raw message