浏览代码

index修改

5 年之前
父节点
当前提交
eefed0ec90

+ 4 - 1
website/src/main/java/com/hssx/website/defaultviewconfig/DefaultView.java

@@ -1,5 +1,6 @@
 package com.hssx.website.defaultviewconfig;
 
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.core.Ordered;
 import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
@@ -11,6 +12,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
  */
 @Configuration
 public class DefaultView extends WebMvcConfigurerAdapter {
+  @Value("${upload.path}")
+  private String path;
   @Override
   public void addViewControllers(ViewControllerRegistry registry) {
     System.out.println("捡来++++++++++222222222222+++++");
@@ -27,6 +30,6 @@ public class DefaultView extends WebMvcConfigurerAdapter {
 //    registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
     //上传的图片在D盘下的OTA目录下,访问路径如:http://localhost:8081/OTA/d3cf0281-bb7f-40e0-ab77-406db95ccf2c.jpg
     //其中OTA表示访问的前缀。"file:D:/OTA/"是文件真实的存储路径
-    registry.addResourceHandler("/upload/**").addResourceLocations("D:\\dolphin\\upload");
+    registry.addResourceHandler("/upload/**").addResourceLocations("file:"+path);
   }
 }

+ 1 - 1
website/src/main/resources/application.properties

@@ -45,7 +45,7 @@ spring.session.store-type=none
 #spring.redis.port=6379
 ######################################################################################################
 # 文件上传路径
-upload.path=D:/mould/upload/
+upload.path=D:/dolphin/upload/
 ######################################################################################################
 # 文件下载路径
 download.path=D:/mould/download/