在 html 页面中引入 thymeleaf 地址
<html xmlns:th="http://www.thymeleaf.org">
thymeleaf 引入 css
<link th:href="@{/css/second.css}" rel="stylesheet">
thymeleaf 引入 js
<!--在src前加th: 在@{}里面写引入访问地址,注意:这里不用写static文件夹-->
<script th:src="@{/js/jquery-3.6.1.js}"></script>
<script th:src="@{/js/second.js}"></script>
thymeleaf 引入 图片
<img th:src="@{/img/2.jpg}" alt="">
静态资源所放位置
参考链接: