title: Spring Boot: can't load file from resources
body: <p>I have few files with SQL queries in my Spring Boot project. These queries are located by path </p>
  
  <pre><code>spring-boot-sql-in-files/src/main/resources/sql/query.sql
  </code></pre>
  
  <p>When I run my application I execute loading of these queries to static variables.</p>
  
  <pre><code>private static final String PATH_PREFIX = "src/main/resources/sql/";
  
  public static String loadQueryFromFile(@NonNull String fileName) {
      try {
          return FileUtils.readFileToString(new File(PATH_PREFIX + fileName), Charset.defaultCharset());
      } catch (Exception e) {
          log.error("Error occurred during loading sql file to string, file=" + fileName, e);
          throw new QueryNotLoadedException();
      }
  }
  </code></pre>
  
  <p>It works fine when I run it using IDE but it doesn't work when I run <code>name.jar</code> file, I get the following error:</p>
  
  <pre><code>java.io.FileNotFoundException: File 'src/main/resources/sql/query.sql' does not exist
  </code></pre>
  
  <p>How can I fix this path?</p>