title: How to "display" files from external folder with spring boot 2.1.1
body: <p>I'm learning spring boot vs 2.1.1</p>
  
  <p>I would like to display in the template image from an external folder.</p>
  
  <p>There is the app structure in tomcat 9:</p>
  
  <pre><code>|-webApp/ws-app     // where ws-app is the running app
  |
  |-webData           // where I would like to get the image to display in template
  </code></pre>
  
  <p>I've read many article from 5 years ago and I've tried to used them without success.
  Like this one: <a href="https://stackoverflow.com/questions/21123437/how-do-i-use-spring-boot-to-serve-static-content-located-in-dropbox-folder">link</a></p>
  
  <p>I've tried to add in application.properties this code:</p>
  
  <pre><code>spring.resources.static-locations=file:///C:/TMP/webData/images
  </code></pre>
  
  <p>Access it from the template like this:</p>
  
  <pre><code>http://localhost:8100/ws-app/img.jpg
  </code></pre>
  
  <p>I get 404 error</p>
  
  <p>I've tried this coding too by creating a class like this :</p>
  
  <pre><code>import org.springframework.boot.autoconfigure.AutoConfigureAfter;
  import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
  import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
  
  
  @Configuration
  @AutoConfigureAfter(DispatcherServletAutoConfiguration.class)
  public class CustomWebMvcAutoConfig implements WebMvcConfigurer {
  
      String myExternalFilePath = "file:///C:/TMP/webData/images";
  
      @Override
      public void addResourceHandlers(ResourceHandlerRegistry registry) {
          registry.addResourceHandler("/images/**").addResourceLocations(myExternalFilePath);
      }
  }
  
  </code></pre>
  
  <p>The same error 404</p>
  
  <p>Someone can help me to understand what I'm doing wrong or give me the correct way if what I'm trying to do is obsolete ?</p>
  
  <p>Thanks so much</p>