在 Spring Mvc 中渲染图像

Render image in SpringMvc

我希望我的图像通过这样的 thymeleaf 表达式显示在 receipt_failure.html 中:

<img th:src="@{/src/main/resources/images/icons-alert-circle.png}" />

Image本身已经入驻这样的SpringMVC文件夹结构:

我不知道问题出在哪里,因为我似乎保留了路径结构,但我在本地环境中遇到了这样的错误

我将 /images 文件夹移动到 /static 文件夹,然后像这样修复 html:

<img th:src="@{/images/icons-alert-circle.png}" />

问题已解决