图片地址映射拦截器配置
package com.land.referral.common.config;
import org.springframework.beans.factory.annotation.Value;
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 FileConfig implements WebMvcConfigurer {
@Value("${file.path-pattern}")
private String filePathPattern;
@Value("${file.locations}")
private String fileLocations;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler(filePathPattern).addResourceLocations("file:" + fileLocations);
}
}