I'm very new to spring boot and following Guru spring framework tutorial.
My simple spring boot application runs successfully and my controller works fine. I have used thymeleaf to show html pages and used some bootstrap css.everything works fine but an image tag that I have in one of my html pages. Thymeleaf shows the correct page when I run the app but image is not shown.I googled about this and put my images under /resources/static/images.This is my project structure :
I have also copied the same image to templates directory and used both files but none can be loaded.
This is my html file :
And this is what I get when I run the application :
404 not found error :
Can anyone tell me what I'm missing?
Try changing to
<img src="../static/images/pirate.jpg" width="1000" th:src="@{images/pirate.jpg}"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With