title: How to load xml resource file using wild card in Spring 3.1
body: <p>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.</p>
  
  <p>This is what I have done so far</p>
  
  <pre><code>String path = "classpath*:/**/definitions/error-definition.xml";
  ClassPathResource resource = new ClassPathResource(path);
  unmarshaller.unmarshall(resource);
  </code></pre>
  
  <p>My resource files are located as follows</p>
  
  <p><code>src/main/resource/module1/definitions/error-definition.xml</code></p>
  
  <pre><code>src/main/resource/module2/definitions/error-definition.xml
  </code></pre>
  
  <p>This gives me the following error</p>
  
  <pre><code>java.io.FileNotFoundException: class path resource [classpath*:/**/definitions/error-definition.xml] cannot be resolved to URL because it does not exist
  </code></pre>
  
  <p>but when I change the path as follows</p>
  
  <pre><code> String path = "/module1/definitions/error-definition.xml";
  </code></pre>
  
  <p>It works</p>
  
  <p>Following are the other wild card which I tried with no luck</p>
  
  <pre><code>String paths = "classpath:/**/definitions/error-definition.xml";
  String paths = "classpath*:error-definition.xml";
  String paths = "classpath*:*.xml";
  </code></pre>
  
  <p>What I want to do is to use wild card to get the xml files from any folder under <code>src/main/resource</code></p>
  
  <p>I referred several previous SO answers but still couldn't figure out what Im doing wrong.</p>