title: Circular View Path Exception in Spring Boot
body: <p>I'm trying to return &quot;index.html&quot; page for every request mapping with below controller:</p>
  <pre><code>import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  
  @Controller
  public class ReactWebController {
      @RequestMapping(value = {&quot;/&quot;, &quot;/login/**&quot;, &quot;/logout/**&quot;, &quot;/forgotpassword/**&quot;, &quot;/home/**&quot;, &quot;/dashboard/**&quot;
              , &quot;/user/**&quot;, &quot;/profile/**&quot;, &quot;/catalog/**&quot;, &quot;/permission/**&quot;, &quot;/diconnect/**&quot;, &quot;/nsm/**&quot;, &quot;/session/**&quot;
              , &quot;/settings/**&quot;, &quot;/log/**&quot;, &quot;/config/**&quot;, &quot;/delete/**&quot;, &quot;/initialize/**&quot;, &quot;/initial/**&quot;, &quot;/changepassword/**&quot;,
              &quot;/portalconnect/**&quot;, &quot;/portal/**&quot;, &quot;/portal/user/**&quot;, &quot;/portal/profile/**&quot;, &quot;/portal/permission/**&quot;,
              &quot;/portal/catalog/**&quot;, &quot;/portal/metadata-browse/**&quot;,&quot;/portal/search/**&quot;,&quot;/portal-object-overview/**&quot;})
      public String react() throws Exception {
          return &quot;index.html&quot;;
      }
  }
  </code></pre>
  <p>The thing is, when I refresh URL it is working when the path is like this: http://localhost:18170/MartServer/user, but not when it has multiple folder kind of paths e.g. http://localhost:18170/MartServer/portal/user. I get below exception details.</p>
  <p><strong>EDIT:</strong> But it is not the case in port 3000 (frontend) where I didn't do any build of complete project, backend and frontend are separate.</p>
  <pre><code>ERROR [/MartServer].[dispatcherServlet].log: Servlet.service() for servlet [dispatcherServlet] in context with path [/MartServer] threw exception [Circular view path [index.html]: would dispatch back to the current handler URL [/MartServer/portal/index.html] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)] with root cause
  javax.servlet.ServletException: Circular view path [index.html]: would dispatch back to the current handler URL [/MartServer/portal/index.html] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
  </code></pre>
  <p>I tried to add <code>addViewControllers()</code> and <code>addResourceHanlders()</code> as well, but no luck. Can anyone help me how to fix this. Thanks!</p>
  <p>Frontend is React JS, index.html is generated after &quot;npm run build&quot; and is used for controller</p>