I want to load xml files which contains some error definitions of several modules in a Spring Maven project. I want to load and then pass the file to a JAXB unmasheller.
This is what I have done so far
String path = "classpath*:/**/definitions/error-definition.xml";
ClassPathResource resource = new ClassPathResource(path);
unmarshaller.unmarshall(resource);
My resource files are located as follows
src/main/resource/module1/definitions/error-definition.xml
src/main/resource/module2/definitions/error-definition.xml
This gives me the following error
java.io.FileNotFoundException: class path resource [classpath*:/**/definitions/error-definition.xml] cannot be resolved to URL because it does not exist
but when I change the path as follows
String path = "/module1/definitions/error-definition.xml";
It works
Following are the other wild card which I tried with no luck
String paths = "classpath:/**/definitions/error-definition.xml";
String paths = "classpath*:error-definition.xml";
String paths = "classpath*:*.xml";
What I want to do is to use wild card to get the xml files from any folder under src/main/resource
I referred several previous SO answers but still couldn't figure out what Im doing wrong.