文章目录
最近课程设计要用springboot,讲到thymeleaf访问html,遇到了下面这种错误,然后我就去找了几种解决办法,希望能帮助到遇到同样错误的小伙伴
1.使用@Controller而不是@RestController
2.配置application.properties
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
3.pom.xml配置
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>