您的位置:首页 > 编程语言 > Java开发

SpringBoot整合Thymeleaf遇到的问题

2020-06-28 05:00 656 查看

1.thymeleaf不访问html

解决:controller中的只能使用@Controller的注解,不能使用@RestController。
@RestController相当于@Controller+ @ResponseBody
参考以下:
https://blog.csdn.net/qq_36838406/article/details/100867004

2. Error resolving template [hello], template might not exist or might not be accessible by any of the configured Template Resolvers

**问题:**找不到html文件
解决:

spring.thymeleaf.prefix=classpath:/templates
在最后添加一个"/":
spring.thymeleaf.prefix=classpath:/templates/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: