title: Configure ViewResolver with Spring Boot and annotations gives No mapping found for HTTP request with URI error
body: <p>I'm trying to make "hello world" application with gradle, spring boot and spring mvc with the simplest view resolver and html.</p>
  
  <p>I started from the <a href="https://spring.io/guides/gs/serving-web-content/" rel="noreferrer">thymeleaf spring  boot example</a> and I just wanted to remove thymeleaf to make a simpler mvc application using pure html and InternalResourceViewResolver. I have a single greeting.html I want to serve which is located at src/main/webapp/WEB-INF. When I run the app I get </p>
  
  <pre><code>No mapping found for HTTP request with URI [/WEB-INF/greeting.html] in DispatcherServlet with name 'dispatcherServlet'
  </code></pre>
  
  <p>This is a common error and there are a lot of answers on the web but nothing seems to help.</p>
  
  <p>Here is my Application.java</p>
  
  <pre><code>@SpringBootApplication
  public class Application {
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  
  <p>Here is my GreetingController.java</p>
  
  <pre><code>@Controller
  public class GreetingController {
      @RequestMapping("/greeting")
      public String greeting() {
          return "greeting";
      }
  }
  </code></pre>
  
  <p>Here is my MvcConfiguration.java</p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  public class MvcConfiguration extends WebMvcConfigurerAdapter{
      @Bean
      public ViewResolver getViewResolver() {
          InternalResourceViewResolver resolver = new InternalResourceViewResolver();
          resolver.setPrefix("/WEB-INF/");
          resolver.setSuffix(".html");
          return resolver;
      }
  }
  </code></pre>
  
  <p>I run it with <code>gradle bootRun</code></p>
  
  <p>Here is the repo with the code: <a href="https://github.com/driver-pete/spring-mvc-example" rel="noreferrer">https://github.com/driver-pete/spring-mvc-example</a></p>
  
  <p>Here are some more clues:</p>
  
  <ul>
  <li>Thymeleaf view resolving works fine</li>
  <li>InternalResourceViewResolver resolves to the right path</li>
  <li>WEB-INF and greeting.html seems to be present in the war file</li>
  <li>I do not have jsp or jstl so I do not miss those jars as some might suggest</li>
  </ul>
  
  <p>My hypothesis is that dispatcher servlet somehow get configured to serve on /* instead of / like <a href="https://stackoverflow.com/questions/17897790/no-mapping-found-for-http-request-with-uri-spring-mvc">here</a> and everywhere. However I don't have web.xml so those advices do not apply here. I see a lot of examples how to configure dispatcher servlet programmatically but I want to keep my app at minimum and I suspect that spring boot is supposed to configure it ok since it works fine with thymeleaf.</p>