【发布时间】:2019-01-02 12:19:25
【问题描述】:
使用百里香做我的 Spring Boot 应用程序,而不是图像,我只看到图像的图标。我怎样才能解决这个问题? 静态图片->图片文件夹
<table class="table table-striped">
<tr th:each="message : ${messages}">
<td th:text="${message.id}"></td>
<td th:text="${message.text}"></td>
<td th:text="${message.tag}"></td>
<td><img th:src="@{/images/thymeleaf.png}"/></td>
</tr>
</table>
【问题讨论】:
-
给出你的 webmvc 配置
-
public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/img/**") .addResourceLocations("file://" + uploadPath + "/"); registry.addResourceHandler("/static/**") .addResourceLocations("classpath:/static/");}
标签: java image spring-mvc spring-boot thymeleaf