磁盤目錄


WebMvcConfig的代碼
//對靜態資源的配置 @Override public void addResourceHandlers(ResourceHandlerRegistry registry) {
String os = System.getProperty("os.name");
if (os.toLowerCase().startsWith("win")) { //如果是Windows系統 registry.addResourceHandler("/smallapple/**")
// /apple/**表示在磁盤apple目錄下的所有資源會被解析為以下的路徑 .addResourceLocations("file:G:/itemsource/smallapple/") //媒體資源 .addResourceLocations("classpath:/META-INF/resources/"); //swagger2頁面 } else { //linux 和mac registry.addResourceHandler("/smallapple/**")
.addResourceLocations("file:/resources/smallapple/") //媒體資源 .addResourceLocations("classpath:/META-INF/resources/"); //swagger2頁面; }
}
數據庫中路徑

測試:

