SpringBoot's mapping rules for static resources

1. All /webjars/**, go to classpath:/META-INF/resources/webjars/ to find resources

webjars: Introduce static resources in the form of jar packages, as follows: Introduce jquery. (http://www.webjars.org/)

<! ‐‐Introduce jquery‐webjar‐‐ > When accessing, you only need to write the name of the resource under webjars
 < dependency > 
  < groupId > org.webjars </ groupId > 
  < artifactId > jquery </ artifactId > 
  < version > 3.3 .1 </ version > 
</ dependency >

 

You can access jquery through this localhost:8080/webjars/jquery/3.3.1/jquery.js

2. "/**" To access any resource of the current project, go to (the folder of static resources) to find the mapping

"classpath:/META‐INF/resources/",
"classpath:/resources/",
"classpath:/static/",
"classpath:/public/"
"/": the root path of the current project

localhost:8080/abc === Go to the static resource folder to find abc

3. Welcome page; All index.html pages under the static resource folder; mapped by "/**";

4. All **/favicon.ico are found under static resource files

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324730022&siteId=291194637