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">