spring boot项目无法访问html
问题如下

项目部分代码如下
controller层

getotp.html文件

已知
html文件是放在templates目录下的
解决方案
导入与springboot整合的thymeleaf依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
导入成功后再次访问该url,成功出现页面

总结
已经不是第一次犯这个错误了,特此记录一下,警示自己!
参考博客:https://blog.csdn.net/qq_40693603/article/details/106764555

浙公网安备 33010602011771号