title: Spring Framework - How to inject a Directory as a Resource?
body: <p>This is the current configuration I have which works ok:</p>
  
  <pre><code>&lt;bean id="foo"
        class="foo.Foo"&gt;
      &lt;constructor-arg&gt;
          &lt;list value-type="org.springframework.core.io.Resource"&gt;
              &lt;value&gt;classpath:bar/01.lookup&lt;/value&gt;
              &lt;value&gt;classpath:bar/02.lookup&lt;/value&gt;
              &lt;value&gt;classpath:bar/03.lookup&lt;/value&gt;
          &lt;/list&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>However, I have hundreds of these .lookup files, so I created a constructor in class <code>Foo</code> which expects a Path to a folder, and my naive approach was:</p>
  
  <pre><code>&lt;bean id="foo"
        class="foo.Foo"&gt;
      &lt;constructor-arg&gt;
          &lt;bean class="org.springframework.core.io.FileSystemResource"&gt;
              &lt;constructor-arg&gt;
                  &lt;value&gt;classpath:bar&lt;/value&gt;
              &lt;/constructor-arg&gt;
          &lt;/bean&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean&gt;  
  </code></pre>
  
  <p>and I was hoping to call <code>listFiles</code> and loop through all <code>.lookup</code> files, but this does not seem to work and I am getting a NullPointerException since the passed path is not resolved as a directory.</p>