1.maven 的pom.xml 文件thymeleaf的依賴配置完成之后
2.application.properties(.yml)文件配置thymeleaf的屬性之后
3.在項目中自定義的js,css文件使用
1) html開始標簽中添加下列的屬性,引入標簽庫
<html lang="en" xmlns:th="http://www.thymeleaf.org">
2)引入css、js等等靜態文件
<script th:src="@{/layuiadmin/layui/layui.js}"></script>
<link rel="stylesheet" th:href="@{/layuiadmin/style/admin.css}" media="all">
其中的@{}表示的是你的項目路徑(application.properties中的配置)
server.servlet.context-path=/labman
當然會自動到resources中static中查找靜態資源
項目結構:
引入的格式如下:
<link rel="stylesheet" th:href="@{/layuiadmin/style/admin.css}" media="all">