title: Spring MVC controller returning view with $END$
body: <p>I'm trying to move from xml config to java config. The application can start without any errors, however the jsp returned with the $END$ when content is different. </p>
  
  <p>I believe I made some stupid mistake somewhere and there are no exceptions thrown</p>
  
  <p><em>Note:</em> when using xml config everything is working fine</p>
  
  <p><strong>Configuration Class</strong></p>
  
  <pre><code>import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.web.servlet.ViewResolver;
  import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  import org.springframework.web.servlet.view.InternalResourceViewResolver;
  import org.springframework.web.servlet.view.JstlView;
  
  @Configuration
  @EnableWebMvc
  @ComponentScan("app.test.portal")
  public class PortalConfiguration {
  
      @Bean
      public ViewResolver viewResolver() {
          InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
          viewResolver.setViewClass(JstlView.class);
          viewResolver.setPrefix("/WEB-INF/views/");
          viewResolver.setSuffix(".jsp");
  
          return viewResolver;
      }
  }
  </code></pre>
  
  <p><strong>Initializer Class</strong></p>
  
  <pre><code>import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
  
  public class PortalInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
  
      @Override
      protected Class&lt;?&gt;[] getRootConfigClasses() {
          return new Class[]{PortalConfiguration.class};
      }
  
      @Override
      protected Class&lt;?&gt;[] getServletConfigClasses() {
          return null;
      }
  
      @Override
      protected String[] getServletMappings() {
          return new String[]{"/"};
      }
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  
  @Controller
  public class IndexController {
  
      @RequestMapping(value = "/home", method = RequestMethod.GET)
      public String index() {
          return "index";
      }
  }
  </code></pre>