栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java > SpringBoot

SpringBoot集成Thymeleaf模板

SpringBoot 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

SpringBoot集成Thymeleaf模板

1 创建一个maven工程,这个应该都会2 pom文件加入下面内容即可(版本号自己改
    
        org.springframework.boot
        spring-boot-starter-parent
        1.5.4.RELEASE
         
    

    
        org.springframework.boot
        spring-boot-starter-thymeleaf
    
3 写一个入口类4 写个home.html5 在工程的resources目录下创建一个application.properties文件,这个文件是spring-boot用来配置一些工程属性用的
# 配置服务器端口,默认是8080,可以不用配置server.port=8080# 模板配置# 这个开发配置为false,避免改了模板还要重启服务器spring.thymeleaf.cache=false# 这个是配置模板路径的,默认就是templates,可不用配置spring.thymeleaf.prefix=classpath:/templates/# 这个可以不配置,检查模板位置spring.thymeleaf.check-template-location=true# 下面3个不做解释了,可以不配置spring.thymeleaf.suffix=.html
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html# 模板的模式spring.thymeleaf.mode=HTML5



作者:芥末无疆sss
链接:https://www.jianshu.com/p/a34f7d330d5d
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/235922.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号