配置信息
#是否缓存,开发模式下设置为false,避免改了模板还要重启服务器
spring.thymeleaf.cache=false
#模板存放目录
spring.thymeleaf.prefix=classpath:/templates
#后缀
spring.thymeleaf.suffix=.html
#是否开启检查
spring.thymeleaf.check-template=true
#是否检查模板路径
spring.thymeleaf.check-template-location=true
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
spring.thymeleaf.mode=HTML5
报错信息
原因
出现这个原因就是因为找不到模板,首先应该检查模板是否存在,然后看配置的模板路径是否正确,这里报错时因为配置路径错误,少了最后斜杆。
修改配置
#模板存放目录
spring.thymeleaf.prefix=classpath:/templates/