0

I am using thymeleaf along with springboot

 I am not able to view any images in my HTML file. I have tried all different ways of doing 
 the same in thymeleaf but no luck.

 Here is my project folder structure

    src
    └───  main
            └───  resources
                      ├───  templates
                      ├───  css
                      └───  images

In HTML File i use:

 <img src="/src/main/resources/static/image.png" alt="images">

1 Answers1

0

After try many thing finally i got the answer

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

And i used it

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