title: WebMvcConfigurerAdapter does not work
body: <p>This is WebConfig code I am working on:</p>
  
  <pre><code>package hello.config;
  
  import org.springframework.context.annotation.Configuration;
  import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
  import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
  
  @Configuration
  public class WebConfig extends WebMvcConfigurerAdapter {
  
      @Override
      public void addViewControllers(ViewControllerRegistry registry) {
          registry.addViewController("/greeting").setViewName("greeting");
      }
  }
  </code></pre>
  
  <p>And this is my Application.class</p>
  
  <pre><code>package hello;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.builder.SpringApplicationBuilder;
  import org.springframework.boot.context.web.SpringBootServletInitializer;
  import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  
  @SpringBootApplication
  public class Application extends SpringBootServletInitializer{
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(Application.class);
      }
  
  }
  </code></pre>
  
  <p>It seems to be a spring-boot issue that these class methods don't get called in some systems. The corresponding issue is reported at:
  <a href="https://github.com/spring-projects/spring-boot/issues/2870" rel="nofollow">https://github.com/spring-projects/spring-boot/issues/2870</a></p>
  
  <p>My question is, can we map resources mapped in this class, outside this class as a temporary workaround?</p>
  
  <p>If yes, how do we do this?</p>
  
  <p><strong>Update:</strong> Following Andy Wilkinson's suggestion I removed <code>@EnableWebMvc</code> and the demo app started working. Then I tried stripping down project files one by one to see at what point error disappears. I found that I had two classes in the project, one, extended from <code>WebMvcConfigurationSupport</code> and the second, from <code>WebMvcConfigurerAdapter</code>. removing the former class from the project fixed the error.</p>
  
  <p>What I want to know is, why did this happen? Secondly, why doesnt this error appear on all systems?</p>