'Circular view path [login]: would dispatch back to the current handler URL [/login] again

Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)



Solution 1:[1]

Add this dependency

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

Solution 2:[2]

I added @ResponseBody annotation on the related controller and the problem has solved.

Note: I work on adding an entity by another rest service.

Before:

@PostMapping("/bayiKaydet")
    public Bayi bayiKaydet(@RequestBody Bayi bayi) {
        serverUrl += "bayiKaydet";
        
        restTemplate.postForEntity(serverUrl, bayi, Bayi.class);
        serverUrl = "http://localhost:8090/";
        return bayi;
    }

After:

@PostMapping("/bayiKaydet")
    @ResponseBody
    public Bayi bayiKaydet(@RequestBody Bayi bayi) {
        serverUrl += "bayiKaydet";
        
        restTemplate.postForEntity(serverUrl, bayi, Bayi.class);
        serverUrl = "http://localhost:8090/";
        return bayi;
    }

Solution 3:[3]

I had this issue in my project, it was just solved by making my Controller class as @RestController

ex...

@RestController

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Michael
Solution 2
Solution 3 Dileep Gowda