商城首页欢迎来到中国正版软件门户

您的位置:首页 >springboot中如何实现默认静态路径

springboot中如何实现默认静态路径

  发布于2023-05-13 阅读(0)

扫一扫,手机访问

类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中如何实现默认静态路径

本文转载于:https://www.yisu.com/zixun/400861.html 如有侵犯,请联系zhengruancom@outlook.com删除。
免责声明:正软商城发布此文仅为传递信息,不代表正软商城认同其观点或证实其描述。

热门关注