title: Why do I always get Whitelabel Error Page with status "404" while running a simple Spring Boot Application
body: <p><strong>My Controller</strong></p>
  
  <pre><code>@Controller
  //@RequestMapping("/")
  //@ComponentScan("com.spring")
  //@EnableAutoConfiguration
  public class HomeController {
  
      @Value("${framework.welcomeMessage}")
      private String message;
  
      @RequestMapping("/hello")
      String home(ModelMap model) {
          System.out.println("hittin the controller...");
          model.addAttribute("welcomeMessage", "vsdfgfgd");
          return "Hello World!";
      }
  
      @RequestMapping(value = "/indexPage", method = RequestMethod.GET)
      String index(ModelMap model) {
          System.out.println("hittin the index controller...");
          model.addAttribute("welcomeMessage", message);
          return "welcome";
      }
  
      @RequestMapping(value = "/indexPageWithModel", method = RequestMethod.GET)
      ModelAndView indexModel(ModelMap model) {
          System.out.println("hittin the indexPageWithModel controller...");
          model.addAttribute("welcomeMessage", message);
          return new ModelAndView("welcome", model);
      }
  }
  </code></pre>
  
  <p><strong>My JSP (welcome.jsp) inside /WEB-INF/jsp</strong> (parent folder is WebContent)</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=UTF-8"
      pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;Welcome to Spring Boot&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  Message: ${message}
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>My pom.xml</strong></p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;SpringBootPlay&lt;/groupId&gt;
      &lt;artifactId&gt;SpringBootPlay&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.4.0.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-logging&lt;/groupId&gt;
              &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
              &lt;version&gt;1.1.3&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
              &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
              &lt;version&gt;1.3.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.jcabi&lt;/groupId&gt;
              &lt;artifactId&gt;jcabi-log&lt;/artifactId&gt;
              &lt;version&gt;0.17&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;start-class&gt;com.spring.play.BootLoader&lt;/start-class&gt;
          &lt;main.basedir&gt;${basedir}/../..&lt;/main.basedir&gt;
          &lt;m2eclipse.wtp.contextRoot&gt;/&lt;/m2eclipse.wtp.contextRoot&gt;
      &lt;/properties&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;useSystemClassLoader&gt;false&lt;/useSystemClassLoader&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>My App Initializer</strong></p>
  
  <pre><code>@EnableAutoConfiguration
  @SpringBootApplication
  @ComponentScan({ "com.spring.controller" })
  @PropertySources(value = { @PropertySource("classpath:/application.properties") })
  public class BootLoader extends SpringBootServletInitializer {
  
      final static Logger logger = Logger.getLogger(BootLoader.class);
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(BootLoader.class);
      }
  
      public static void main(String[] args) {
          SpringApplication.run(BootLoader.class, args);
      }
  }
  </code></pre>
  
  <p>I even added <code>thymeleaf</code> dependency to my pom. It still didn't work. When ever I hit <code>localhost:8080/hello or /indexPage or /indexPageWithModel</code> it always says</p>
  
  <p>Whitelabel Error Page</p>
  
  <p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p>
  
  <p>Wed Sep 21 21:34:18 EDT 2016
  There was an unexpected error (type=Not Found, status=404).
  ]/WEB-INF/jsp/welcome.jsp</p>
  
  <p><strong>My application.properties</strong></p>
  
  <pre><code>spring.mvc.view.prefix: /WEB-INF/jsp/
  spring.mvc.view.suffix: .jsp
  framework.welcomeMessage=Welcome to Dashboard
  </code></pre>
  
  <p>Please help me. Thanks!</p>