package com.bonus.system.config;


import com.bonus.system.file.util.SystemUtils;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
	/**
	 * 外部文件访问
	 */
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		String filePath= SystemUtils.getUploadPath();
		/** 本地文件上传路径 */
		registry.addResourceHandler("/statics/**")
				.addResourceLocations("file:" + filePath+"/");
		registry.addResourceHandler("/files/**")
				.addResourceLocations("file:"+filePath);
	}

}
