This may be the result of an unspecified view, due to default view name generation 报错解决
javax.servlet.ServletException: Circular view path [index]: would
dispatch back to the current handler URL [/index] again. Check your View Resolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
三种解决方法:
1.在@Controller上添加@ResonseBody 出现这个报错是因为@Controller上面缺少 @ResonseBody,因为没有@ResonseBody的话就会自动认为我们的Controller返回的是一个页面
ps:@ResonseBody会将返回值设置为JSON格式
2.@RestController=@ResonseBody+@Controller 也就是说我们直接用一个@RestController就能解决问题,而不需要用两个注解
3.在pom.xml中添加thymeleaf依赖
<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> ```