Spring returns FileSystemResource instead of ClassPathResource

I am trying to get a list of files in the classpath, but Spring returns Resource [] from FileSystemResources instead of ClassPathResources. This is what the code looks like:

PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource [] resources = resolver.getResources("classpath*:my/package/**/*.xml");

I also tried this:

context.getResources("classpath*:my/package/**/*.xml");

The returned array is a set of absolute path: // URL files, when what I really want is a classpath: URL. What am I doing wrong?

This is what I want to build in the end:

/my/package/one.xml
/my/package/two.xml

Instead, I get the following:

file:/C:/eclipse/.../my/package/one.xml
+3
source share
1 answer

FileSystemResource ClassPathResource . FileSystemResource C:/eclipse/.../my/package/one.xml. ClassPathResource classpath /WEB-INF/classes. , classpath:path, .

0

All Articles