Problem
在调试时可以加载/static/目录下的全部样式,在运行时找不到。
我的目录如下
Solution
(1)application.yml加入
resources:
add-mappings: true
(2)引入css
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
.......
<link rel="stylesheet" type="text/css" href="../static/css/me.css" th:href="@{/css/me.css}">
(3)对于用到的image
<img src="../static/images/myPhoto.jpeg" th:src="@{/images/myPhoto.jpeg}" alt="" class="ui avatar image">
(4)如果不行的话,重启一下idea再看看