使用SpringBoot+Thyemleaf 遇到的问题

使用SpringBoot+Thyemleaf 遇到的问题,第1张

1. 使用Thyemleaf 模板时Controller 层要使用@Controller注解,使用RestController注解不会返回html页面 2. 要在application.properties配置文件里面添加Thyemleaf 配置
#返回页面的路径
spring.thymeleaf.prefix=classpath:/templates/
#文件后缀
spring.thymeleaf.suffix=.html
#模式
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.servlet.content-type=text/html
#编码格式
spring.thymeleaf.encoding=utf-8
#不需要缓存
spring.thymeleaf.cache=false
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/730465.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-04-27
下一篇2022-04-27

发表评论

登录后才能评论

评论列表(0条)

    保存