mirror of
				https://gitee.com/lab1024/smart-admin.git
				synced 2025-11-04 10:23:43 +08:00 
			
		
		
		
	本地问题 下载预览需要在系统参数里面配置访问路径 我这边涉及文件的都是这个问题。
默认路径: http://[ip:端口号]/preview/[文件key] 参考:net.lab1024.sa.common.config.MvcConfig#addResourceHandlers 这里配置。
This commit is contained in:
		@@ -3,6 +3,7 @@ package net.lab1024.sa.common.config;
 | 
			
		||||
import net.lab1024.sa.common.common.interceptor.AbstractInterceptor;
 | 
			
		||||
import org.apache.commons.collections4.CollectionUtils;
 | 
			
		||||
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.HandlerInterceptor;
 | 
			
		||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 | 
			
		||||
@@ -27,6 +28,9 @@ public class MvcConfig implements WebMvcConfigurer {
 | 
			
		||||
    @Autowired(required = false)
 | 
			
		||||
    private List<HandlerInterceptor> interceptorList;
 | 
			
		||||
 | 
			
		||||
    @Value("${file.storage.local.path}")
 | 
			
		||||
    private String uploadPath;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void addInterceptors (InterceptorRegistry registry) {
 | 
			
		||||
        if (CollectionUtils.isEmpty(interceptorList)) {
 | 
			
		||||
@@ -39,7 +43,8 @@ public class MvcConfig implements WebMvcConfigurer {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
 | 
			
		||||
        registry.addResourceHandler("/preview/**");
 | 
			
		||||
        registry.addResourceHandler("/preview/**")
 | 
			
		||||
                .addResourceLocations("classpath:/META-INF/resources/","classpath:/resources/","classpath:/static/","file:" + uploadPath);;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user