说明:以下内容为个人所想,不能保证正确性,如有错误,欢迎指正。(里面的用词描述可能不正确,希望各位大佬能够指出,以便进步)
错误描述
javax.servlet.ServletException: Circular view path [login]: would dispatch back to the current handler URL [/zhuzhu/login/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
解决方式
引入thymeleaf依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
出现原因
当映射的html文件在templates文件夹中,请求路径和映射路劲相同时并且没有引入thymeleaf依赖,就会报以上错误。
@RequestMapping("/login")
public String tologin() {
return "login";
}
拓展:如果请求路径和映射路劲不同并且没有引入thymeleaf依赖,会报404。