31 lines
1.0 KiB
Java
31 lines
1.0 KiB
Java
package io.dataease.config;
|
|
|
|
import static io.dataease.commons.constants.StaticResourceConstants.*;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
import static io.dataease.commons.utils.StaticResourceUtils.ensureBoth;
|
|
import static io.dataease.commons.utils.StaticResourceUtils.ensureSuffix;
|
|
|
|
/**
|
|
* Author: wangjiahao
|
|
* Date: 2022/4/24
|
|
* Description:
|
|
*/
|
|
@Configuration
|
|
public class DeMvcConfig implements WebMvcConfigurer {
|
|
/**
|
|
* Configuring static resource path
|
|
*
|
|
* @param registry registry
|
|
*/
|
|
@Override
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
String workDir = FILE_PROTOCOL + ensureSuffix(WORK_DIR, FILE_SEPARATOR);
|
|
String uploadUrlPattern = ensureBoth(UPLOAD_URL_PREFIX, URL_SEPARATOR) + "**";
|
|
registry.addResourceHandler(uploadUrlPattern)
|
|
.addResourceLocations(workDir);
|
|
|
|
}
|
|
}
|