springboot 默认静态路径

代码如下所示
类ResourceProperties.class

private static final String[] CLASSPATH_RESOURCE_LOCATIONS = new String[]{"classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"};
private String[] staticLocations;

public ResourceProperties() {
  this.staticLocations = CLASSPATH_RESOURCE_LOCATIONS;
  this.addMappings = true;
  this.chain = new ResourceProperties.Chain();
  this.cache = new ResourceProperties.Cache();
}

根据构造方法可知, staticLocations等于默认的CLASSPATH_RESOURCE_LOCATIONS, 也即"classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"

classpath即为我们如下图所示的resource文件夹
Springboot 默认静态路径

相关文章:

  • 2021-05-30
  • 2021-11-29
  • 2021-05-11
  • 2022-12-23
  • 2021-05-19
  • 2022-01-09
  • 2021-06-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-26
  • 2022-01-12
  • 2021-11-07
  • 2021-04-13
相关资源
相似解决方案