SpringBoot整合Thymeleaf遇到的问题

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/

你可能感兴趣的:(SpringBoot整合Thymeleaf遇到的问题)