Spring Boot find a lot of pictures of the project access solutions found are configured, sometimes configured to no avail. Then their own research a simple method of operation.
1. Create a new directory img (or images) in the static directory of Spring Boot
2, right-img directory, Rebuild (Ctrl + Shift + F9)
3, to copy a picture img directory, right picture, Recompile (Ctrl + Shift + 9), recompile
4, the browser visit http: // localhost: 8080 / img / hzy.png
ps:
If you can not access the picture error occurs:
Why you need to be rebuilt or recompiled to access to the pictures?
Personal understanding is that if there are no new images or create a new folder, then recompile, spring boot will not be able to find them in memory and spring boot belongs, so we can not access to.