title: Serve html files in Spring and Thymeleaf without Request Mapping
body: <p>I have a problem with mine mappings. I have a template resolver which has the following configuration:</p>
  
  <pre><code>    @Bean(name="templateResolver")
      public ServletContextTemplateResolver getServletContextTemplateResolver() {
          ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
          templateResolver.setPrefix("/WEB-INF/views/");
          templateResolver.setSuffix(".html");
          templateResolver.setTemplateMode("HTML5");
          templateResolver.setCharacterEncoding("UTF-8");
          templateResolver.setCacheable(false);
          return templateResolver;
      }
  
      @Bean(name="templateEngine")
      public SpringTemplateEngine getTemplateEngine() {
          SpringTemplateEngine templateEngine = new SpringTemplateEngine();
          templateEngine.setTemplateResolver(getServletContextTemplateResolver());
          return templateEngine;
      }
  
      @Bean(name="viewResolver")
      public ThymeleafViewResolver getThymeleafViewResolver() {
          ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
          viewResolver.setTemplateEngine(getTemplateEngine());
          viewResolver.setOrder(1);
          viewResolver.setCharacterEncoding("UTF-8");
          return viewResolver;
      }
  </code></pre>
  
  <p>And I have a structure of my project:</p>
  
  <pre><code>-WEB-INF
  --views
  ---home.html
  ---registration.html
  </code></pre>
  
  <p>I'm using thymeleaf and spring 4.0. For home, I have added the following requestMapping in my controller:</p>
  
  <pre><code>@RequestMapping(value = "/", method = RequestMethod.GET)
  public String start(Model model) {
      return "home";
  }
  </code></pre>
  
  <p>I don't have request mapping for registration.html.</p>
  
  <p>In my home.html I have following link (thymeleaf anchor tag):</p>
  
  <pre><code>        &lt;a href="registration.html" th:href="@{/registration.html}" th:text="#{navigation.registration}"&gt;Registration&lt;/a&gt;
  </code></pre>
  
  <p>I have binded my app in tomcat under /myapp and when I enter on /myapp I get the home.html page (I have a request mapping for that), but when I enter on /myapp/registration.html i get 404. </p>
  
  <p>What I must do, to serve such static html files without adding every page to the controller? Is it possible? I tried with static resources but it doesn't work.</p>
  
  <p>I also tried to move views directory level up so I had structure:</p>
  
  <pre><code>-WEB-INF
  -views
  --home.html
  --registration.html
  </code></pre>
  
  <p>and I was able to enter on /myapp/views/registration.html, but I couldn't get into /myapp/registration.html</p>