title: Spring Boot shows the String instead of the HTML file from an Angular2 Single Page app
body: <p>I'm trying to map all <code>GET</code> requests to unmapped url of the site to show the <code>index.html</code> file.</p>
  
  <p>So, I created the following <code>@RestController</code>:</p>
  
  <pre><code>@RequestMapping(method=RequestMethod.GET)
  public String redirectToIndex() {
      return "index.html";
  }
  </code></pre>
  
  <p>My <code>index.html</code> is in <code>resources/static/index.html</code>. I also tried the following controller:</p>
  
  <pre><code>@RequestMapping(method=RequestMethod.GET)
  public String redirectToIndex() {
      return "/static/index.html";
  }
  </code></pre>
  
  <p>However, in both cases, browser literally shows the strings <code>index.html</code> and <code>/static/index.html</code> respectively instead of showing the html file. I tried a lot of different other approaches to similar questions here but can't get it to resolve... Please help.</p>
  
  <p>EDIT:</p>
  
  <p>My fill <code>@RequestController</code> class:</p>
  
  <pre><code>@RestController
  public class FeedbackController {
      @Autowired
      private FeedbackService feedbackService;
  
      @RequestMapping(method=RequestMethod.POST, value="/feedback")
      public Feedback addFeedback(@RequestBody Feedback feedback) {
          return feedbackService.addFeedback(feedback);
      }
  
      @RequestMapping(method=RequestMethod.GET)
      public String redirectToIndex() {
          return "index.html";
      }
  
  }
  </code></pre>
  
  <p>My <code>pom.xml</code>:</p>
  
  <pre><code>&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.5.8.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&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;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;/plugins&gt;
      &lt;/build&gt;
  </code></pre>