package com.bicloud.config;


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 StaticResourceConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 使用 "file:./" 前缀代表项目根路径（无论项目怎么移动,开发部署都不影响）
        registry.addResourceHandler("/img/**")
                .addResourceLocations("file:./media/img/");
        registry.addResourceHandler("/video/**")
                .addResourceLocations("file:./media/video/");
    }
}