亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

SpringBoot集成Thymeleaf模板

標簽:
SpringBoot

1 创建一个maven工程,这个应该都会

2 pom文件加入下面内容即可(版本号自己改

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>

3 写一个入口类

4 写个home.html

5 在工程的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
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。


點擊查看更多內容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優質文章

正在加載中
  • 推薦
  • 評論
  • 收藏
  • 共同學習,寫下你的評論
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消