title: Spring-Boot Resource Not Found when using executeable Jar
body: <p>again I face a strange issue and hope someone here can help. </p>
  
  <p>I have a spring boot backend module, what works in eclipse well and application is executeable when starting main in application.java. Everything fine.</p>
  
  <p>My application makes import of example data to database using csv-files what is included in src/main/resources folder. As mentioned, when starting in eclipse everything works.</p>
  
  <p>Now I would like to execute it as executable jar, the application begins to start and then it failed to start, because it cannot find the csv files. The path what it prints out, where it looked for the files, is correct and the csv files are in the jar included.</p>
  
  <p>The Pom of the module looks like follows:</p>
  
  <pre><code>&lt;project&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;at.company.bbsng&lt;/groupId&gt;
          &lt;artifactId&gt;bbsng-import&lt;/artifactId&gt;
          &lt;version&gt;0.1.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;bbsng-import-backend&lt;/artifactId&gt;
      &lt;name&gt;bbsng-import-backend&lt;/name&gt;
  
      &lt;properties&gt;
          &lt;start-class&gt;at.company.bbsng.dataimport.Application&lt;/start-class&gt;
      &lt;/properties&gt;
  
  
      &lt;dependencies&gt;
  
          &lt;!-- SPRING ... --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-batch&lt;/artifactId&gt;
              &lt;!-- EXCLUDE LOGBACK AND USE LOG4J --&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-log4j&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- COMMONS ... --&gt;
  
          ...
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;repackage&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Path to csv-files are configured in propery files as follows:</p>
  
  <pre><code># EXAMPLE PATH
  csv.path=config/csv/
  </code></pre>
  
  <p>The part of java config file is as follows:</p>
  
  <pre><code>  ...
  
    @Value("${csv.path}")
    private String csvExamplePath;
  
    @Bean
    public Resource addressResource() {
      return new ClassPathResource(csvExamplePath + CSV_ADDRESS);
    }
  
      ...
  </code></pre>
  
  <p>In the jar the files are located at path </p>
  
  <pre><code>\config\csv\
  </code></pre>
  
  <p>Stacktrace:</p>
  
  <pre><code>Caused by: java.io.FileNotFoundException: class path resource [config/csv/Company.csv] cannot be resolved to absolute file path because it does not reside in th
  e file system: jar:file:/C:/Development/Projekte/bbsng/trunk/import/backend/target/bbsng-import-backend-0.1.0-SNAPSHOT.jar!/config/csv/Company.csv
          at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:207)
          at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:52)
          at at.compax.bbsng.dataimport.app.source.company.CompanyGenerator.init(CompanyGenerator.java:28)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java
  </code></pre>
  
  <p>Again, the application works as expected when starting it from eclipse, only executable jar complains about missing csv-files, what are in jar already.</p>
  
  <p>Any clue would be great.</p>