title: 404 Not Found when accessing static HTML in Spring Boot
body: <p>I've been trying to reference Spring's guides (which hasn't been too useful to the inexperienced me for completing this particular task in full) to create a simple toy example: Handle a form submission as a POST request and display the result.</p>
  
  <p><strong>Update</strong>: <code>ViewConfiguration</code> class added - see bottom of question for further information.</p>
  
  <p>This is my project structure:</p>
  
  <pre><code>src
   |  main
   |   |  java
   |   |   |  controllers
   |   |   |   |  BasicController.java
   |   |   |   |  RestfulController.java
   |   |   |  Application.java
   |   |   |  ViewConfiguration.java
   |   |  resources
   |   |   |  static
   |   |   |   |  form.html
  </code></pre>
  
  <p>My code are as follows:</p>
  
  <pre><code>@SpringBootApplication
  public class Application {
    public static void main(String[] args) {
      SpringApplication.run(Application.class, args);
    }
  }
  
  @Controller
  public class BasicController {
    @RequestMapping("/")
    public String greeting() {
      return "form";
    }
  }
  
  @RestController
  public class RestfulController {
    @RequestMapping(value="/result", method=RequestMethod.POST)
    public String parseForm(@RequestParam String name) {
      return name;
    }
  }
  
  @Configuration
  public class ViewConfiguration extends WebMvcConfigurerAdapter {
    @Bean
    public UrlBasedViewResolver urlBasedViewResolver() {
      UrlBasedViewResolver resolver = new urlBasedViewResolver();
      resolver.setPrefix("/static");
      resolver.setSuffix(".html");
      resolver.setCache(false);
      return resolver;
    }
  }
  </code></pre>
  
  <p>For <code>form.html</code>:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Form&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;form action="result" method="post"&gt;
        Name: &lt;input type="text" name="name"&gt;
        &lt;br&gt;&lt;br&gt;
        &lt;input type="submit" value="Submit"&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I run the above in Eclipse as a Java Application, the URL <code>http://localhost:8080/</code> only yields a <code>HTTP 404 Not Found</code> error. I've tried all of the following return values for <code>greeting()</code> without success:</p>
  
  <ul>
  <li>form</li>
  <li>form.html</li>
  <li>/form</li>
  <li>/form.html</li>
  <li>/static/form</li>
  <li>/static/form.html</li>
  <li>/resources/static/form</li>
  <li>/resources/static/form.html</li>
  </ul>
  
  <p>I have a pre-existing application that processes GET requests correctly when I submit a hard-coded URL. However, I need to use POST instead. As far as I know, this can't tested via a hard-coded URL - it must be done through a form submission. So far I have been unable to replicate the earlier success I had with the GET version.</p>
  
  <p><strong>Update</strong>: Following suggestions in the answers below, I added a view resolver but instead of using a third party one like Thyme, I created a basic, custom one as shown above.</p>
  
  <p>At present, I've received an <code>IllegalArgumentException: Property 'viewClass' is required</code></p>
  
  <p>All the online tutorials I can find use <code>resolver.setViewClass(JstlView.class);</code> but since just about all of my views are static <code>.html</code> pages, I'm not sure I should be using <code>JstlView</code>. It is also clear from the above that I can't just leave it blank either.</p>
  
  <p>What should I set <code>viewClass</code> as? Are there any other mistakes in my code at present? Ultimately, how do I get this to work?</p>