title: Spring Boot Unable to find File using ClassPathResource
body: <p>Using Spring Boot. I am trying to parse an excel file stored locally within the project using Apache POI library. My directory structure is like so:</p>
  
  <ul>
  <li><p>src</p>
  
  <ul>
  <li><p>main</p>
  
  <ul>
  <li><p>java</p>
  
  <ul>
  <li>com.app
  
  <ul>
  <li>controllers</li>
  <li>models</li>
  <li>repositories     &lt;- I am calling from here</li>
  </ul></li>
  </ul></li>
  <li><p>resources</p>
  
  <ul>
  <li>static
  
  <ul>
  <li>Test.xlsx     &lt;- I'm trying to access this</li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>
  
  <hr>
  
  <pre><code>File excel = new ClassPathResource("Test.xlsx").getFile();
  
  File file = new File(classLoader.getResource("src/main/resources/static/test.xlsx").getFile());
  </code></pre>
  
  <p>I have tried both of the above ways to access the file, and I have tried many variations of paths to the file, but nothing has worked. I do not get build errors or runtime errors, the file is simply not found and when I attempt to invoke the method I get a NullPointerException on that line.</p>