springboot——关于template might not exist or might not be accessible的问题

springboot——关于template might not exist or might not be accessible的问题

springboot——关于template might not exist or might not be accessible的问题

这其实是springboot开发中的一个非常容易忽略的地方,遇到这种错误时候,

1、检查路径有没有错。

2、特别留意自己的项目是否需要返回对象到body区。

3、形如 “localhost:8080/A/B.html” 的,则要确认B.html是否存在于对应目录的A文件夹中,且文件名是否正确。

很明显,顶部图片的错误是犯了上面第二点,当改为:

springboot——关于template might not exist or might not be accessible的问题

springboot——关于template might not exist or might not be accessible的问题

即可正常返回。