I'm using Spring's PathMatchingResourcePatternResolver to attempt to get a list of .jmx files (JMeter tests) that are currently in my src/main/resources directory. This will be hosted as a WAR file on AWS.
When I'm working locally, I have this code block giving me a list of the .jmx files in the resources/ directory, but I know can't use my local file path:
PathMatchingResourcePatternResolver resolver =
new PathMatchingResourcePatternResolver(MyClass.class.getClassLoader());
Resource[] resources = resolver.getResources("file:/C:/Users/user.name/repos/my-repo/src/main/resources/dailyTests/*.jmx")
I've been trying to use classpath*: and this actually almost works:
Resource[] resources = resolver.getResources("classpath*:*.jmx");
This will get me all of my .jmx files, with URLs that look like this:
file:/C:/Users/user.name/repos/my-repo/target/classes/my_jmeter_test.jmx
But I need to be able to handle sub directories of the resources directory as well. When I attempt to be more specific, I believe I'm entering incorrect patterns. From what I understand, when using classpath* you still need to use a root directory after classpath*:, but I'm not sure what that should be.
So far I've tried
Resource[] resources = resolver.getResources("classpath*:Users/*.jmx");
Resource[] resources = resolver.getResources("classpath*:classes/*.jmx");
Resource[] resources = resolver.getResources("classpath*:WEB-INF/*.jmx");
Resource[] resources = resolver.getResources("classpath*:com/*.jmx");
And many other guesses, all of which returned 0 resources. It seems when I just get one step more specific, I'm getting 0 resources.
I suppose I might be misunderstanding how I should navigate a WAR file, or possible just misunderstanding what classpath* gets me. Am I completely off here?