【发布时间】:2019-03-23 23:36:36
【问题描述】:
我有一个带有以下 @Request 映射的简单 Spring Boot MVC 控制器。我正在使用 Thymeleaf 进行查看。
@RequestMapping({"", "/", "index", "index.html"})
public String index(){
return "index";
}
index.html 存在于 resources/templates/index.html 中,我可以使用 http://localhost:8080 查看它
但是,http://localhost:8080/index 和 http://localhost:8080/index.html 会导致出现白标错误页面。我做错了什么?
【问题讨论】:
-
因为这是有效的。你还有其他配置吗?
-
没有。这是我的 repo github.com/ximanta/pet-clinic-web 我正在引用 github.com/springframeworkguru/sfg-pet-clinic 并且令人惊讶的是它的工作原理。