|
|
@@ -1,8 +1,11 @@
|
|
|
package com.campus.trade.config;
|
|
|
|
|
|
+import com.campus.trade.interceptor.AdminInterceptor;
|
|
|
+import com.campus.trade.interceptor.AuthInterceptor;
|
|
|
import com.campus.trade.interceptor.AdminInterceptor;
|
|
|
import com.campus.trade.interceptor.AuthInterceptor;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
|
@@ -17,10 +20,13 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
@Autowired
|
|
|
private AdminInterceptor adminInterceptor;
|
|
|
|
|
|
+ @Value("${upload.dir}")
|
|
|
+ private String uploadDir;
|
|
|
+
|
|
|
@Override
|
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
registry.addResourceHandler("/upload/**")
|
|
|
- .addResourceLocations("file:./upload/");
|
|
|
+ .addResourceLocations("file:" + uploadDir + "/");
|
|
|
}
|
|
|
|
|
|
@Override
|