The default , SpringBoot looks for static resources from two places:
-
Under classpath / static directory
-
ServletContext under the root directory
A, classpath / static directory
In common static class path directory name must be static .
index.html
<! DOCTYPE HTML > < HTML > < head > < Meta charset = "UTF-8" > < title > static resource access method a </ title > </ head > < body > static resource access method a < br > < img alt = "" src = "ImagesRF Royalty Free / java.png" > <-! do not write static -> </ body > </ HTML >
Two, ServletContext root directory
Add webapp in src / main, the name must be webapp.