【发布时间】:2019-03-29 09:59:58
【问题描述】:
我已将 Thymeleaf 添加到我的 Spring Boot 项目中。
我在/resources/templates/index.html中创建了一个HTML文件
我在@RestController 中添加了一个方法:
@RequestMapping("/")
public String index(Model model, OAuth2Authentication authentication) {
// irreveland code here
return "index";
}
似乎这种方法有点用,但我没有将我重定向到http://localhost:8080/templates/index.html,而是有一个带有“索引”字样的白页(源代码中没有 html,只有字 index )
我已尝试将 index.html 页面放入 /resources/static 和 /resources 以进行测试 - 不费吹灰之力。
这里可能出了什么问题?
【问题讨论】:
标签: java spring spring-boot thymeleaf