一、所有/webjars/**的请求,都会去classpath:/META-INF/resources/webjars/下的目录去找资源。

 

二、访问/**,即访问任何资源,如果没有controller处理该请求,就默认到以下静态资源文件夹中寻找资源

  • "classpath:/META-INF/resources/"

  • "classpath:/resources/"

  • "classpath:/static/"

  • "classpath:/public/"

  • "/"

三、欢迎页

当我们直接访问localhost:8080地址时,springboot默认会到以下静态文件夹中找index.html

"classpath:/META-INF/resources/"

"classpath:/resources/"

"classpath:/static/"

"classpath:/public/"

"/"

 

四、自定义静态资源文件夹

spring.resources.static-locations=classpath:/hello/,classpath:/xxx/,classpath:/xxx/,.......

当我们指定自定义静态资源文件夹,则springboot默认的静态资源文件夹就会失效。即以下springboot默认的静态资源文件夹失效。

"classpath:/META-INF/resources/"

"classpath:/resources/"

"classpath:/static/"

"classpath:/public/"

"/"

 

相关文章:

  • 2021-04-22
  • 2021-05-17
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2021-11-03
猜你喜欢
  • 2021-04-16
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
  • 2023-02-27
  • 2021-09-12
相关资源
相似解决方案