SpringBoot系列---【如何在springboot官網找thymleaf依賴?並集成Thymeleaf】


1.參照下面圖片中標紅的步驟

 

 2.經過步驟1就拿到了每個版本最新的資料了。

 

 3.這里以集成thymleaf為例

 

 4.找到pom依賴,springboot內置了thymleaf,引入依賴即可使用,把靜態頁面放到template包下,通過controller訪問

 

 

<dependency>
     <groupId>org.thymeleaf</groupId>
     <artifactId>thymeleaf-spring5</artifactId>
</dependency>
<dependency>
     <groupId>org.thymeleaf.extras</groupId>
     <artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>

 5.此時在template包下新建html文件,並在頂部加上約束,

<html xmlns:th="http://www.thymeleaf.org">這里選擇3.0的原因是springboot2.2這個版本引入的就是thymeleaf3.0,具體看點進pom的parent的頂層artifactId
dependencyManagement依賴管理中查看。

 

 6.按照官網的文檔進行thymeleaf語法學習

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM