-
首先引入
spring-boot-starter-thymeleaf
-
配置信息,比较简单
-
配置controller 使用@Controller
-
最后直接return页面就可以
测试的时候一直报错
Error resolving template [], template might not exist or might not be accessible by any of the configured Template Resolvers
我遇到的问题是,文件夹包括文件都是在另一个项目里复制过来的,templates下还有一个文件夹,html文件就在子文件夹下面
删除子文件夹就可以正常访问了
想在子文件夹保存文件,手动新建子文件夹(Directory),也可以正常访问