title: Spring MVC - Invalid view being executed (violating specified request mapping)
body: <p>I have been trying to debug it for like hours and even tried to create the same project over and again. I don't know whether it's the issue due to IntelliJ IDEA or something else. I tried to google but couldn't find any solution. I am making a simple spring mvc demo application in intelliJ. A default structure was provided by intelliJ and a view "index.jsp" in web directory.</p>
  
  <p><a href="https://i.stack.imgur.com/WltJg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WltJg.png" alt="project structure"></a></p>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
       id="WebApp_ID" version="3.1"&gt;
  
  &lt;display-name&gt;spring-mvc-demo&lt;/display-name&gt;
  
  &lt;!-- Spring MVC Configs --&gt;
  
  &lt;!-- Step 1: Configure Spring MVC Dispatcher Servlet --&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring-mvc-demo-servlet.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;!-- Step 2: Set up URL mapping for Spring MVC Dispatcher Servlet --&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>spring-mvc-demo-servlet.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:mvc="http://www.springframework.org/schema/mvc"
     xsi:schemaLocation="
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context.xsd
      http://www.springframework.org/schema/mvc
      http://www.springframework.org/schema/mvc/spring-mvc.xsd"&gt;
  
  &lt;!-- Step 3: Add support for component scanning --&gt;
  &lt;context:component-scan base-package="com.luv2code.springdemo" /&gt;
  
  &lt;!-- Step 4: Add support for conversion, formatting and validation support --&gt;
  &lt;mvc:annotation-driven/&gt;
  
  &lt;!-- Step 5: Define Spring MVC view resolver --&gt;
  &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix" value="/WEB-INF/view/" /&gt;
      &lt;property name="suffix" value=".jsp" /&gt;
  &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>DebugController.java</strong></p>
  
  <pre><code>package com.luv2code.springdemo;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  
  /**
   * Created by gaurav.ahirwar on 29/05/17.
   */
  
  @Controller
  
  public class DebugController {
  
      @RequestMapping(value="/", method = RequestMethod.GET)
      public String debug() {
          return "hello";
      }
  }
  </code></pre>
  
  <p>The problem is that whenever I run the project and hit localhost:8080/ then index.jsp is executed but according to my configuration and mapping hello.jsp should be loaded. It may be possible that I am doing some silly mistake but I have tried as much as I can and now really frustrated. Please help me out. Thanks.</p>
  
  <p>localhost:8080</p>
  
  <p><a href="https://i.stack.imgur.com/AAKyK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AAKyK.png" alt="index.jsp loaded at root"></a></p>