@Configuration
public class WebConfigurer implements WebMvcConfigurer {
@Value("${SavePath.ProfilePhoto}")
private String ProfilePhotoSavePath; //图标图片存储路径
@Value("${SavePath.ProfilePhotoMapper}")
private String ProfilePhotoMapperPath; //图标映射路径
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
//addResourceHandler映射路径、addResourceLocations真实存放路径
registry.addResourceHandler(ProfilePhotoMapperPath+"**")
.addResourceLocations("file:" + ProfilePhotoSavePath);
}
}
spring boot 图片映射配置
于 2022-07-21 10:09:12 首次发布