Relative paths in spring classpath resource

Posted by Mike Q on Stack Overflow See other posts from Stack Overflow or by Mike Q
Published on 2009-10-21T14:16:20Z Indexed on 2010/06/16 10:22 UTC
Read the original article Hit count: 341

Filed under:
|
|
|
|

Hi all,

I have a bunch of spring config files, all of which live under the META-INF directory in various subpackages. I have been using import like the following...

  <import resource="../database/schema.xml"/>

So a relative path from the source file. This works fine when I am working with a local build outside of a jar file. But when I package everything up in a jar then I get an error that it cannot resolve the URL resource. If I change the above to an absolute path (with classpath:) then it works fine.

Is there any way to use relative paths with ".." in when the configs are packaged in a jar or am I restricted to descending relative paths and absolute paths only?

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about spring