title: How to fix "Circular view path" exception error? - Springboot
body: <p>//I was shown this error in the log when I ran this code -&gt;</p>
  <blockquote>
  <p>Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Circular view path [Students]: would dispatch back to the current handler URL [/Students] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)] with root cause &quot;</p>
  </blockquote>
  <pre class="lang-java prettyprint-override"><code>//Controller class
  
  import java.util.List;
  
  @Controller
  public class StudnetController {
  
      @Autowired
      private StudentService studentService;
  
      @GetMapping(path = &quot;/Students&quot;)
      public List&lt;Student&gt; getAllStudent(){
  
      return studentService.getStudent();
          
      }
  
  }
  </code></pre>
  <pre class="lang-java prettyprint-override"><code>//service class
  
  
  @Service
  public class StudentService {
  
      @Autowired
      private StudentRepo studentRepo;
  
      public List&lt;Student&gt; getStudent(){
  
          return studentRepo.findAll();
      }
  </code></pre>