package com.docus.server.message.config;

import com.docus.server.message.consts.StaticResourceMapping;
import com.docus.server.message.util.TableJsonRead;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.io.File;

/**
 * @author WYBDEV
 */
@Configuration
public class StaticResourceWebConfig implements WebMvcConfigurer {


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 静态资源映射 输血报告单
        registry.addResourceHandler("/"+ StaticResourceMapping.BLOOD +"/**")
                .addResourceLocations("file:"+ TableJsonRead.currentPath(StaticResourceMapping.STATIC_RESOURCE_PREFIX+ File.separator+StaticResourceMapping.BLOOD)+File.separator);
    }

}
