引言:在开发过程过程中有可能会遇到前后端都自己写的时候所以把我搭建boot时返回静态页面的方法记录下来
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
一般情况下在创建boot项目时都会有支持web的jar包但是需要注意的是spring-boot-starter-thymeleaf也需要导入否则抛出404异常 如:
所以
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
这个是需要的;
其次就是yml中的配置了
扫描templates文件下的.html页面
然后我的项目接结构
不足之处请指出,谢谢