Spring boot 使用Thymeleaf和Springboot时未显示img

Spring boot 使用Thymeleaf和Springboot时未显示img,spring-boot,thymeleaf,Spring Boot,Thymeleaf,我正在使用thymeleaf和springboot 我无法查看HTML文件中的任何图像。我已经尝试了所有不同的方法来做同样的事,但没有运气 这是我的项目文件夹结构 With Boot's default configuration, your images (and other static content), need to be beneath src/main/resources/static. For example, to serve content from /images put

我正在使用thymeleaf和springboot

我无法查看HTML文件中的任何图像。我已经尝试了所有不同的方法来做同样的事,但没有运气

这是我的项目文件夹结构

With Boot's default configuration, your images (and other static content), need to be beneath 
src/main/resources/static
. For example, to serve content from
/images
put the files in
src/main/resources/static/images

This may help. I am using it in my application and no error shown (at least in Mozilla). use ../.. to access files and directories in your application.

<img alt="Caption X" class="rounded-circle img-responsive mt-2"
   height="128" th:src="@{/../static/images/theImage.png}" width="128">

使用Boot的默认配置,您的映像(和其他静态内容)需要位于
src/main/resources/static
下面。例如,要提供来自
/images
的内容,请将文件放入
src/main/resources/static/images
中,这可能会有所帮助。我正在我的应用程序中使用它,并且没有显示任何错误(至少在Mozilla中)。 使用../。。访问应用程序中的文件和目录

正如安迪·威尔金森所说的- 使用Boot的默认配置,您的映像(和其他静态内容)需要位于
src/main/resources/static
下面。例如,要提供来自
/images
的内容,请将文件放入
src/main/resources/static/images

并以这种方式使用它

<img th:src="@{/images/image.png}" alt="image" width="300" height="200">


谢谢,它现在起作用了。但是,我必须手动创建该静态文件夹,因为我从STS获取了无效的标识符名称,用于将包名创建为“static”。在将图像添加到
src/main/resources/static/IMG.jpg
后,
的路径如何?它会是
。/../resources/static/IMG.jpg吗?