title: Spring-Boot Jersey: allow Jersey to serve static content
body: <p>The application uses JDK 8, Spring Boot &amp; Spring Boot Jersey starter and is packaged as a WAR (although it is locally run via Spring Boot Maven plugin).</p>
  
  <p>What I would like to do is to get the documentation I generate on the fly (at build time) as a welcome page.</p>
  
  <p>I tried several approaches:</p>
  
  <ol>
  <li>letting Jersey serving the static contents by configuring in <code>application.properties</code> <a href="https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyProperties.java#L61" rel="noreferrer">the proper init parameter</a> as described <a href="https://stackoverflow.com/questions/12422660/jersey-servlet-mapping-causes-404-error-for-static-resources">here</a></li>
  <li>introduce a <code>metadata-complete=false</code> <code>web.xml</code> in order to list the generated HTML document as a welcome-file.</li>
  </ol>
  
  <p>None of that worked out.</p>
  
  <p>I would like to avoid having to enable Spring MVC or creating a Jersey resource just for serving a static file.</p>
  
  <p>Any idea?</p>
  
  <p>Here is the Jersey configuration class (I unsuccessfully tried to add a <code>ServletProperties.FILTER_STATIC_CONTENT_REGEX</code> there):</p>
  
  <pre><code>@ApplicationPath("/")
  @ExposedApplication
  @Component
  public class ResourceConfiguration extends ResourceConfig {
  
     public ResourceConfiguration() {
        packages("xxx.api");
        packages("xxx.config");
        property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true);
        property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
     }
  }
  </code></pre>
  
  <p>And here is Spring Boot application class (I tried adding an <code>application.properties</code> with <code>spring.jersey.init.jersey.config.servlet.filter.staticContentRegex=/.*html</code> but it didn't work, I'm not exactly sure what the property key should be here):</p>
  
  <pre><code>@SpringBootApplication
  @ComponentScan
  @Import(DataConfiguration.class)
  public class Application extends SpringBootServletInitializer {
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(Application.class);
      }
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>