title: Java Spring classpath resource path to folder
body: <p>If we would like to use relative path to file we use following code:</p>
  
  <pre><code>@Override
  public void setRootFolderResource(Resource rootFolderResource) {
      try {
          this.rootFolder = rootFolderResource.getFile().getAbsolutePath();
          log.info(String.format(ROOT_FOLDER_RESOURCE, rootFolder));
      } catch (IOException e) {
          log.error(String.format(ROOT_FOLDER_RESOURCE_EXCEPTION, e.getMessage()));
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>And bean config:</p>
  
  <pre><code>&lt;bean name="fileClient" class="com.myproject.clients.FileClientImpl" depends-on="propertyConfigurer" scope="prototype"&gt;
      &lt;property name="rootFolderResource"&gt;&lt;value&gt;${storage.path}&lt;/value&gt;&lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Where: </p>
  
  <pre><code>storage.path=classpath:data/data.txt
  </code></pre>
  
  <p>it works for file data.txt. How to do we change code if we need path to folder?:</p>
  
  <pre><code>storage.path=classpath:data/foldername
  </code></pre>